From 671af1fce0969a8363a97bbe20e524c6040982fc Mon Sep 17 00:00:00 2001 From: Qxisylolo Date: Thu, 21 Nov 2024 16:48:13 +0800 Subject: [PATCH] integration test Signed-off-by: Qxisylolo --- ...space_saved_objects_client_wrapper.test.ts | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/src/plugins/workspace/server/saved_objects/integration_tests/workspace_saved_objects_client_wrapper.test.ts b/src/plugins/workspace/server/saved_objects/integration_tests/workspace_saved_objects_client_wrapper.test.ts index 82c943545aca..7cf808770ff8 100644 --- a/src/plugins/workspace/server/saved_objects/integration_tests/workspace_saved_objects_client_wrapper.test.ts +++ b/src/plugins/workspace/server/saved_objects/integration_tests/workspace_saved_objects_client_wrapper.test.ts @@ -200,27 +200,25 @@ describe('WorkspaceSavedObjectsClientWrapper', () => { describe('bulkGet', () => { it('should throw forbidden error when user not permitted', async () => { - let error; - try { - await notPermittedSavedObjectedClient.bulkGet([ - { type: 'dashboard', id: 'inner-workspace-dashboard-1' }, - ]); - } catch (e) { - error = e; - } - expect(error).not.toBeUndefined(); - expect(SavedObjectsErrorHelpers.isForbiddenError(error)).toBe(true); + const result = await notPermittedSavedObjectedClient.bulkGet([ + { type: 'dashboard', id: 'acl-controlled-dashboard-2' }, + ]); - error = undefined; - try { - await notPermittedSavedObjectedClient.bulkGet([ - { type: 'dashboard', id: 'acl-controlled-dashboard-2' }, - ]); - } catch (e) { - error = e; - } - expect(error).not.toBeUndefined(); - expect(SavedObjectsErrorHelpers.isForbiddenError(error)).toBe(true); + expect(result.saved_objects).toEqual([ + { + id: 'acl-controlled-dashboard-2', + type: 'dashboard', + attributes: {}, + error: { + error: 'Invalid saved objects permission', + statusCode: 403, + message: 'Permission denied', + }, + permissions: {}, + references: [], + workspaces: [], + }, + ]); }); it('should return consistent dashboard when user permitted', async () => {