Skip to content

Commit

Permalink
add all unit test and fix code error
Browse files Browse the repository at this point in the history
Signed-off-by: yubonluo <yubonluo@amazon.com>
  • Loading branch information
yubonluo committed Mar 28, 2024
1 parent c3f0ce6 commit c0f62aa
Show file tree
Hide file tree
Showing 17 changed files with 2,036 additions and 341 deletions.
6 changes: 1 addition & 5 deletions src/plugins/saved_objects_management/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ export {
export { SavedObjectRelation, SavedObjectWithMetadata, SavedObjectMetadata } from './types';
export { SAVED_OBJECT_DELETE_TRIGGER, savedObjectDeleteTrigger } from './triggers';
export { SavedObjectDeleteContext } from './ui_actions_bootstrap';
export {
showDuplicateModal,
SavedObjectsDuplicateModal,
DuplicateMode,
} from './management_section';
export { SavedObjectsDuplicateModal, DuplicateMode } from './management_section';
export function plugin(initializerContext: PluginInitializerContext) {
return new SavedObjectsManagementPlugin();
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ describe('copy saved objects', () => {
const includeReferencesDeep = true;
const targetWorkspace = '1';
await duplicateSavedObjects(httpClient, objects, includeReferencesDeep, targetWorkspace);
expect(httpClient.post).toMatchInlineSnapshot(
`
expect(httpClient.post).toMatchInlineSnapshot(`
[MockFunction] {
"calls": Array [
Array [
Expand All @@ -34,7 +33,36 @@ describe('copy saved objects', () => {
},
],
}
`
);
`);

await duplicateSavedObjects(httpClient, objects, undefined, targetWorkspace);
expect(httpClient.post).toMatchInlineSnapshot(`
[MockFunction] {
"calls": Array [
Array [
"/api/saved_objects/_copy",
Object {
"body": "{\\"objects\\":[{\\"type\\":\\"dashboard\\",\\"id\\":\\"1\\"},{\\"type\\":\\"visualization\\",\\"id\\":\\"2\\"}],\\"includeReferencesDeep\\":true,\\"targetWorkspace\\":\\"1\\"}",
},
],
Array [
"/api/saved_objects/_copy",
Object {
"body": "{\\"objects\\":[{\\"type\\":\\"dashboard\\",\\"id\\":\\"1\\"},{\\"type\\":\\"visualization\\",\\"id\\":\\"2\\"}],\\"includeReferencesDeep\\":true,\\"targetWorkspace\\":\\"1\\"}",
},
],
],
"results": Array [
Object {
"type": "return",
"value": undefined,
},
Object {
"type": "return",
"value": undefined,
},
],
}
`);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@
*/

export { mountManagementSection } from './mount_section';
export { showDuplicateModal, SavedObjectsDuplicateModal, DuplicateMode } from './objects_table';
export { SavedObjectsDuplicateModal, DuplicateMode } from './objects_table';
Loading

0 comments on commit c0f62aa

Please sign in to comment.