Skip to content

Commit

Permalink
Tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
imnasnainaec committed Feb 13, 2024
1 parent 96365d4 commit 2520ee8
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jest.mock(

jest.mock("components/Pronunciations/PronunciationsFrontend", () => "div");

// Bypass the Autocomplete and render its internal input with the props of both
/** Bypass the Autocomplete and render its internal input with the props of both. */
const mockAutocomplete = (props: {
renderInput: (params: any) => ReactElement;
}): ReactElement => {
Expand Down Expand Up @@ -136,7 +136,7 @@ describe("NewEntry", () => {
renderer.root.findByType(GlossWithSuggestions).props.handleEnter();
});
expect(mockAddNewEntry).toHaveBeenCalledTimes(1);
expect(mockResetNewEntry).toHaveBeenCalledTimes(0);
expect(mockResetNewEntry).not.toHaveBeenCalled();

// Run the timers and confirm a reset
await act(async () => {
Expand All @@ -163,14 +163,14 @@ describe("NewEntry", () => {
gloss.props.handleEnter();
});
expect(mockAddNewEntry).toHaveBeenCalledTimes(1);
expect(mockResetNewEntry).toHaveBeenCalledTimes(0);
expect(mockResetNewEntry).not.toHaveBeenCalled();

// Attempt a second submission before the first one completes
await act(async () => {
gloss.props.handleEnter();
});
expect(mockAddNewEntry).toHaveBeenCalledTimes(1);
expect(mockResetNewEntry).toHaveBeenCalledTimes(0);
expect(mockResetNewEntry).not.toHaveBeenCalled();

// Run the timers and confirm no second submission
await act(async () => {
Expand Down

0 comments on commit 2520ee8

Please sign in to comment.