Skip to content

Commit

Permalink
Revert "fix: unit test error"
Browse files Browse the repository at this point in the history
This reverts commit 80bed72.

Signed-off-by: SuZhou-Joe <[email protected]>
  • Loading branch information
SuZhou-Joe committed Mar 12, 2024
1 parent a5fd308 commit 3980cd7
Showing 1 changed file with 1 addition and 32 deletions.
33 changes: 1 addition & 32 deletions src/core/public/http/http_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('#setup()', () => {
expect(setupResult.basePath.get()).toEqual('');
});

it('setup basePath with workspaceId provided in window.location.href and workspace feature enabled', () => {
it('setup basePath with workspaceId provided in window.location.href', () => {
const windowSpy = jest.spyOn(window, 'window', 'get');
windowSpy.mockImplementation(
() =>
Expand All @@ -94,43 +94,12 @@ describe('#setup()', () => {
} as any)
);
const injectedMetadata = injectedMetadataServiceMock.createSetupContract();
injectedMetadata.getPlugins.mockReturnValueOnce([
{
id: 'workspace',
plugin: {
id: 'workspace',
configPath: '',
requiredPlugins: [],
optionalPlugins: [],
requiredEnginePlugins: {},
requiredBundles: [],
},
},
]);
const fatalErrors = fatalErrorsServiceMock.createSetupContract();
const httpService = new HttpService();
const setupResult = httpService.setup({ fatalErrors, injectedMetadata });
expect(setupResult.basePath.get()).toEqual('/w/workspaceId');
windowSpy.mockRestore();
});

it('setup basePath with workspaceId provided in window.location.href but workspace feature disabled', () => {
const windowSpy = jest.spyOn(window, 'window', 'get');
windowSpy.mockImplementation(
() =>
({
location: {
href: 'http://localhost/w/workspaceId/app',
},
} as any)
);
const injectedMetadata = injectedMetadataServiceMock.createSetupContract();
const fatalErrors = fatalErrorsServiceMock.createSetupContract();
const httpService = new HttpService();
const setupResult = httpService.setup({ fatalErrors, injectedMetadata });
expect(setupResult.basePath.get()).toEqual('');
windowSpy.mockRestore();
});
});

describe('#stop()', () => {
Expand Down

0 comments on commit 3980cd7

Please sign in to comment.