From 3980cd74688fad303727c3bbfe4e5732d40742d4 Mon Sep 17 00:00:00 2001 From: SuZhou-Joe Date: Tue, 12 Mar 2024 14:38:04 +0800 Subject: [PATCH] Revert "fix: unit test error" This reverts commit 80bed72a6c66dacde6f9f1591f7c348a0a5aeb4f. Signed-off-by: SuZhou-Joe --- src/core/public/http/http_service.test.ts | 33 +---------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/src/core/public/http/http_service.test.ts b/src/core/public/http/http_service.test.ts index c6301b26d1d1..5671064e4c52 100644 --- a/src/core/public/http/http_service.test.ts +++ b/src/core/public/http/http_service.test.ts @@ -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( () => @@ -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()', () => {