Skip to content

Commit

Permalink
fix: workspace routes integration failed (opensearch-project#251)
Browse files Browse the repository at this point in the history
Signed-off-by: Lin Wang <wonglam@amazon.com>
  • Loading branch information
wanglam authored and SuZhou-Joe committed Mar 18, 2024
1 parent f7b057b commit b7a4a28
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/plugins/workspace/server/integration_tests/routes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
});
});
});

0 comments on commit b7a4a28

Please sign in to comment.