Skip to content

Commit

Permalink
integration test
Browse files Browse the repository at this point in the history
Signed-off-by: Qxisylolo <[email protected]>
  • Loading branch information
Qxisylolo committed Nov 21, 2024
1 parent 7eaed18 commit 671af1f
Showing 1 changed file with 18 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down

0 comments on commit 671af1f

Please sign in to comment.