Skip to content

Commit

Permalink
temp: add unit test
Browse files Browse the repository at this point in the history
Signed-off-by: SuZhou-Joe <[email protected]>
  • Loading branch information
SuZhou-Joe committed Sep 19, 2023
1 parent 73fe409 commit fb2b21e
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions test/api_integration/apis/workspace/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import expect from '@osd/expect';
import { WorkspaceAttribute } from 'opensearch-dashboards/server';
import { FtrProviderContext } from '../../ftr_provider_context';

const testWorkspace: WorkspaceAttribute = {
id: 'fake_id',
name: 'test_workspace',
description: 'test_workspace_description',
};

export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const opensearch = getService('legacyOpenSearch');

const MILLISECOND_IN_WEEK = 1000 * 60 * 60 * 24 * 7;

describe('Workspace CRUD apis', () => {
it('basic CRUD', async () => {
const resp = await supertest
.post(`/api/workspaces`)
.set('osd-xsrf', 'opensearch-dashboards')
.send(
JSON.stringify({
attributes: testWorkspace,
})
)
.expect(200);

expect(resp.body).to.be.an('array');
expect(resp.body.length).to.be.above(0);
expect(resp.body[0].status).to.be('not_installed');
});
});
}

0 comments on commit fb2b21e

Please sign in to comment.