Skip to content

Instantly share code, notes, and snippets.

@tfiechowski
Last active November 8, 2018 12:49
Show Gist options
  • Save tfiechowski/f3fa43668bb4af97800652d0b6773e79 to your computer and use it in GitHub Desktop.
Save tfiechowski/f3fa43668bb4af97800652d0b6773e79 to your computer and use it in GitHub Desktop.
import { mount } from 'enzyme';
import { PhotosContextInner } from './PhotosContext';
describe('PhotosContext', () => {
test('fetchPhotos', async () => {
const api = {
fetchPhotos: () => ({ data: [{ caption: 'photo caption', src: 'src' }] }),
};
const wrapper = mount(<PhotosContextInner api={api} />);
expect(wrapper.state()).toMatchSnapshot();
await wrapper.instance().fetchPhotos();
expect(wrapper.state()).toMatchSnapshot();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment