import React from 'react'; import expect from 'expect'; import { shallow, render } from 'enzyme'; import { html } from 'cheerio'; import { Authenticated } from './Authenticated'; describe('', () => { const Foo = () =>
Foo
; it('should call userCheck on mount', () => { const userCheck = jest.fn(); shallow( ); expect(userCheck.mock.calls.length).toEqual(1); }); it('should call userCheck on update', () => { const userCheck = jest.fn(); const wrapper = shallow( ); wrapper.setProps({ location: { pathname: 'foo' }, userCheck }); expect(userCheck.mock.calls.length).toEqual(2); }); it('should render its child by default', () => { const userCheck = jest.fn(); const wrapper = render( ); expect(html(wrapper)).toEqual('
Foo
'); }); });