Skip to content

Instantly share code, notes, and snippets.

@lotif
Last active June 17, 2017 02:05
Show Gist options
  • Save lotif/90e557d4bae78e37c295c313b60a3422 to your computer and use it in GitHub Desktop.
Save lotif/90e557d4bae78e37c295c313b60a3422 to your computer and use it in GitHub Desktop.
integration test with promises
it('should change the text on click', async () => {
http.get.mockImplementation(() => Promise.resolve({ body: 'the-return-of-my-get-request' }));
const sut = mount(
<Provider store={store}>
<MyComponent />
</Provider>
);
sut.find('div').simulate('click');
await flushAllPromises();
expect(sut.find('div').prop('children')).toEqual('the-return-of-my-get-request');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment