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 17, 2024
1 parent 804e50f commit 0810ec5
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
{
Expand All @@ -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',
{
Expand All @@ -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.]`
);
});
});
Expand Down Expand Up @@ -469,6 +469,7 @@ describe('WorkspaceConflictSavedObjectsClientWrapper', () => {
});
expect(mockedClient.find).toBeCalledWith({
type: DATA_SOURCE_SAVED_OBJECT_TYPE,
workspaces: null,
});
});
});
Expand Down

0 comments on commit 0810ec5

Please sign in to comment.