Skip to content
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.

Commit

Permalink
Fix failed JS test, at least locally
Browse files Browse the repository at this point in the history
Add async and await,
to prevent the Jest error:
Warning: You seem to have overlapping act calls.
  • Loading branch information
kienstra committed Apr 23, 2020
1 parent 8d83241 commit 120126f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions js/blocks/components/test/fetch-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ describe( 'FetchInput', () => {
[ [ 'a-result' ], false ],
[ [ 'first-result', 'another-result' ], false ],
] )( 'should only have the error class if there are no results after focusing',
( apiResults, expected ) => {
async ( apiResults, expected ) => {
apiFetch.mockImplementationOnce( () => new Promise( ( resolve ) => resolve( apiResults ) ) );
const { input } = setup( baseProps );
fireEvent.focus( input );

waitForDomChange( { container: input } ).then( () => {
await waitForDomChange( { container: input } ).then( () => {
expect( input.classList.contains( 'text-control__error' ) ).toStrictEqual( expected );
} );
}
Expand Down

0 comments on commit 120126f

Please sign in to comment.