Skip to content

Commit

Permalink
fix: unit test
Browse files Browse the repository at this point in the history
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
  • Loading branch information
SuZhou-Joe committed Apr 15, 2024
1 parent 2119304 commit b1494b1
Showing 1 changed file with 14 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,28 +88,21 @@ describe('WorkspaceIdConsumerWrapper', () => {
);
});

it(`Should throw error when trying to create unallowed type within a workspace`, async () => {
expect(() =>
wrapperClient.bulkCreate([
getSavedObject({
type: 'config',
id: 'foo',
}),
])
).toThrow('type: config is not allowed to create within a workspace.');
it(`Should skip the objects when trying to create unallowed type within a workspace`, async () => {
await wrapperClient.bulkCreate([
getSavedObject({
type: 'config',
id: 'foo',
}),
getSavedObject({
type: DATA_SOURCE_SAVED_OBJECT_TYPE,
id: 'foo',
}),
]);

expect(() =>
wrapperClient.bulkCreate([
getSavedObject({
type: DATA_SOURCE_SAVED_OBJECT_TYPE,
id: 'foo',
}),
getSavedObject({
type: UI_SETTINGS_SAVED_OBJECTS_TYPE,
id: 'bar',
}),
])
).toThrow('type: data-source, type: config are not allowed to create within a workspace.');
expect(mockedClient.bulkCreate).toBeCalledWith([], {
workspaces: ['foo'],
});
});
});

Expand Down

0 comments on commit b1494b1

Please sign in to comment.