From 0810ec5647c93e63c7713394dcce948000cd27aa Mon Sep 17 00:00:00 2001 From: SuZhou-Joe Date: Wed, 17 Apr 2024 17:03:34 +0800 Subject: [PATCH] fix: unit test Signed-off-by: SuZhou-Joe --- ...cts_wrapper_for_check_workspace_conflict.test.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/plugins/workspace/server/saved_objects/saved_objects_wrapper_for_check_workspace_conflict.test.ts b/src/plugins/workspace/server/saved_objects/saved_objects_wrapper_for_check_workspace_conflict.test.ts index c242470fb9b5..2cbfb951bbee 100644 --- a/src/plugins/workspace/server/saved_objects/saved_objects_wrapper_for_check_workspace_conflict.test.ts +++ b/src/plugins/workspace/server/saved_objects/saved_objects_wrapper_for_check_workspace_conflict.test.ts @@ -118,7 +118,7 @@ describe('WorkspaceConflictSavedObjectsClientWrapper', () => { }); it(`Should throw error when trying to create disallowed types in workspace`, async () => { - expect(() => + await expect( wrapperClient.create( DATA_SOURCE_SAVED_OBJECT_TYPE, { @@ -129,11 +129,11 @@ describe('WorkspaceConflictSavedObjectsClientWrapper', () => { workspaces: ['foo'], } ) - ).toThrowErrorMatchingInlineSnapshot( - `"Unsupported type in workspace: 'data-source' is not allowed to create in workspace."` + ).rejects.toMatchInlineSnapshot( + `[Error: Unsupported type in workspace: 'data-source' is not allowed to create in workspace.]` ); - expect(() => + await expect( wrapperClient.create( 'config', { @@ -144,8 +144,8 @@ describe('WorkspaceConflictSavedObjectsClientWrapper', () => { workspaces: ['foo'], } ) - ).toThrowErrorMatchingInlineSnapshot( - `"Unsupported type in workspace: 'config' is not allowed to create in workspace."` + ).rejects.toMatchInlineSnapshot( + `[Error: Unsupported type in workspace: 'config' is not allowed to create in workspace.]` ); }); }); @@ -469,6 +469,7 @@ describe('WorkspaceConflictSavedObjectsClientWrapper', () => { }); expect(mockedClient.find).toBeCalledWith({ type: DATA_SOURCE_SAVED_OBJECT_TYPE, + workspaces: null, }); }); });