Skip to content

Instantly share code, notes, and snippets.

@tsh-code
Created April 9, 2019 06:13
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save tsh-code/fed00953fbcce16f6660d1693807e50c to your computer and use it in GitHub Desktop.
import React from 'react';
import { mount } from 'enzyme';
import { UsersComponent } from './users.component';
const data = [
{
id: '5c76f0b7bb5c210da0f8554a',
firstName: 'Florine',
lastName: 'Russell',
email: 'florine.russell$email..org',
},
];
describe('Users component', () => {
it('renders list loading and then list with one row', async () => {
const fetchUsersList = jest.fn(() => new Promise(resolve => resolve(data)));
const wrapper = mount(<UsersComponent fetchUsersList={fetchUsersList}/>);
await expect(fetchUsersList).toHaveBeenCalled();
wrapper.update();
expect(wrapper).toMatchSnapshot();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment