Skip to content

Commit

Permalink
Add test for enabled opeartors
Browse files Browse the repository at this point in the history
Signed-off-by: Hailong Cui <ihailong@amazon.com>
  • Loading branch information
Hailong-am committed Apr 10, 2024
1 parent 8ce8373 commit bb9076a
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/plugins/workspace/server/integration_tests/routes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,42 @@ describe('workspace service api integration test', () => {
expect(result.body.success).toEqual(true);
expect(typeof result.body.result.id).toBe('string');
});
it('create workspace failed when name duplicate', async () => {
let result: any = await osdTestServer.request
.post(root, `/api/workspaces`)
.send({
attributes: omitId(testWorkspace),
})
.expect(200);

expect(result.body.success).toEqual(true);

await opensearchServer.opensearch.getClient().indices.refresh({ index: '.kibana' });

// same name
result = await osdTestServer.request
.post(root, `/api/workspaces`)
.send({
attributes: omitId(testWorkspace),
})
.expect(200);

expect(result.body.success).toEqual(false);
expect(result.body.error).toEqual(
'workspace name has already been used, try with a different name'
);

// verify simple query string flags is NONE
result = await osdTestServer.request
.post(root, `/api/workspaces`)
.send({
attributes: { ...omitId(testWorkspace), name: 'test test_workspace' },
})
.expect(200);

expect(result.body.success).toEqual(true);
});

it('get', async () => {
const result = await osdTestServer.request
.post(root, `/api/workspaces`)
Expand Down

0 comments on commit bb9076a

Please sign in to comment.