Skip to content

Instantly share code, notes, and snippets.

@BenBrostoff
Last active August 11, 2019 19:23
Show Gist options
  • Save BenBrostoff/934bb121200a78227578967b1a85494d to your computer and use it in GitHub Desktop.
Save BenBrostoff/934bb121200a78227578967b1a85494d to your computer and use it in GitHub Desktop.
Pass / fail sync act
it('should render with the correct text without act', () => {
ReactDOM.render(<App/>, el);
expect(el.innerHTML).toContain('unloaded val');
});
it('should render with the correct text with act', () => {
act(() => {
ReactDOM.render(<App/>, el);
});
expect(el.innerHTML).toContain('sync val');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment