Last active
August 11, 2019 19:23
-
-
Save BenBrostoff/1b13a6b1da5b3294864bd257f924480e to your computer and use it in GitHub Desktop.
Test async act
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('should render with the correct text with sync act', () => { | |
act(() => { | |
ReactDOM.render(<AsyncApp/>, el); | |
}); | |
expect(el.innerHTML).toContain('unloaded val'); | |
}); | |
it('should render with the correct text with async act', async () => { | |
await act(async () => { | |
ReactDOM.render(<AsyncApp/>, el); | |
}); | |
expect(el.innerHTML).toContain('fetched val'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment