Skip to content

Commit 49db107

Browse files
test: fix: await the correct alert
Co-authored-by: Brian Smith <[email protected]>
1 parent a908ef2 commit 49db107

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/library-authoring/create-legacy-library/CreateLegacyLibrary.test.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,16 +180,15 @@ describe('<CreateLegacyLibrary />', () => {
180180
await user.click(slugInput);
181181
await user.type(slugInput, 'test_library_slug');
182182

183-
fireEvent.click(await screen.findByRole('button', { name: /create/i }));
183+
await user.click(await screen.findByRole('button', { name: /create/i }));
184184
await waitFor(async () => {
185185
expect(axiosMock.history.post.length).toBe(1);
186186
expect(axiosMock.history.post[0].data).toBe(
187187
'{"display_name":"Test Library Name","org":"org1","number":"test_library_slug"}',
188188
);
189189
expect(mockNavigate).not.toHaveBeenCalled();
190-
const errorMessage = 'Request failed with status code 400{ "field": "Error message" }';
191-
expect(await screen.findByRole('alert')).toHaveTextContent(errorMessage);
192190
});
191+
await screen.findByText('Request failed with status code 400');
193192
});
194193

195194
test('cancel creating library navigates to libraries page', async () => {

0 commit comments

Comments
 (0)