SHARE
TWEET

Untitled

a guest Feb 12th, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React from 'react';
  2. import Enzyme, { mount } from 'enzyme';
  3. import Adapter from 'enzyme-adapter-react-16';
  4. import { SimpleComponent } from './SimpleComponent';
  5.  
  6. const getMenuMock = jest.fn();
  7.  
  8. Enzyme.configure({ adapter: new Adapter() });
  9.  
  10. describe('SimpleComponent', () => {
  11.   it('async call getMenu is resolved', async () => {
  12.     getMenuMock.mockReturnValue(Promise.resolve())
  13.     const wrapper = mount(<SimpleComponent getMenu={getMenuMock}/>);
  14.     await Promise.resolve();
  15.     expect(wrapper.state().isLoading).toBe(true);
  16.   })
  17. })
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top