Skip to content

Commit

Permalink
Remove waitFor in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ErlingHauan committed Nov 1, 2024
1 parent b30e077 commit 6798bc9
Showing 1 changed file with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { screen, waitFor } from '@testing-library/react';
import { screen } from '@testing-library/react';
import { EditManualOptionsWithEditor } from './EditManualOptionsWithEditor';
import { renderWithProviders } from '../../../../../../testing/mocks';
import { textMock } from '@studio/testing/mocks/i18nMock';
Expand Down Expand Up @@ -141,14 +141,12 @@ describe('EditManualOptionsWithEditor', () => {
await user.click(addNewButton);
await user.click(addNewButton);

await waitFor(() => {
expect(mockHandleComponentChange).toHaveBeenCalledWith({
...mockComponent,
options: [
{ label: '', value: '' },
{ label: '', value: '' },
],
});
expect(mockHandleComponentChange).toHaveBeenCalledWith({
...mockComponent,
options: [
{ label: '', value: '' },
{ label: '', value: '' },
],
});
});

Expand All @@ -174,11 +172,9 @@ describe('EditManualOptionsWithEditor', () => {

await user.click(addNewButton);

await waitFor(() => {
expect(mockHandleComponentChange).toHaveBeenCalledWith({
...mockComponent, // does not contain optionsId
options: [{ label: '', value: '' }],
});
expect(mockHandleComponentChange).toHaveBeenCalledWith({
...mockComponent, // does not contain optionsId
options: [{ label: '', value: '' }],
});
});
});

0 comments on commit 6798bc9

Please sign in to comment.