Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from 'react';
- import Enzyme, { mount } from 'enzyme';
- import Adapter from 'enzyme-adapter-react-16';
- import { SimpleComponent } from './SimpleComponent';
- const getMenuMock = jest.fn();
- Enzyme.configure({ adapter: new Adapter() });
- describe('SimpleComponent', () => {
- it('async call getMenu is resolved', async () => {
- getMenuMock.mockReturnValue(Promise.resolve())
- const wrapper = mount(<SimpleComponent getMenu={getMenuMock}/>);
- await Promise.resolve();
- expect(wrapper.state().isLoading).toBe(true);
- })
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement