From b7a4a28771e0ab01bda0b0c08eaf190a4c5a2435 Mon Sep 17 00:00:00 2001 From: Lin Wang Date: Tue, 27 Feb 2024 18:38:09 +0800 Subject: [PATCH] fix: workspace routes integration failed (#251) Signed-off-by: Lin Wang --- .../server/integration_tests/routes.test.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/plugins/workspace/server/integration_tests/routes.test.ts b/src/plugins/workspace/server/integration_tests/routes.test.ts index 061d0f3c406..21d6f155a92 100644 --- a/src/plugins/workspace/server/integration_tests/routes.test.ts +++ b/src/plugins/workspace/server/integration_tests/routes.test.ts @@ -53,12 +53,14 @@ describe('workspace service', () => { const savedObjectsRepository = osd.coreStart.savedObjects.createInternalRepository([ WORKSPACE_TYPE, ]); - await Promise.all( - listResult.body.result.workspaces.map((item: WorkspaceAttribute) => - // this will delete reserved workspace - savedObjectsRepository.delete(WORKSPACE_TYPE, item.id) + await expect( + Promise.all( + listResult.body.result.workspaces.map((item: WorkspaceAttribute) => + // this will delete reserved workspace + savedObjectsRepository.delete(WORKSPACE_TYPE, item.id) + ) ) - ); + ).resolves.toBeInstanceOf(Array); }); it('create', async () => { await osdTestServer.request @@ -194,7 +196,8 @@ describe('workspace service', () => { page: 1, }) .expect(200); - expect(listResult.body.result.total).toEqual(2); + // Global and Management workspace will be created by default after workspace list API called. + expect(listResult.body.result.total).toEqual(4); }); it('unable to perform operations on workspace by calling saved objects APIs', async () => { const result = await osdTestServer.request @@ -256,7 +259,8 @@ describe('workspace service', () => { }) .expect(200); expect(findResult.body.total).toEqual(0); - expect(listResult.body.result.total).toEqual(1); + // Global and Management workspace will be created by default after workspace list API called. + expect(listResult.body.result.total).toEqual(3); }); }); });