import * as React from 'react'; import expect from 'expect'; import { render } from '@testing-library/react'; import { ListContext } from './ListContext'; import { useListContext } from './useListContext'; describe('useListContext', () => { const NaiveList = props => { const { data } = useListContext(props); return ( ); }; it('should return the listController props form the ListContext', () => { const { getByText } = render( ); expect(getByText('hello')).not.toBeNull(); }); it('should return injected props if the context was not set', () => { jest.spyOn(console, 'log').mockImplementationOnce(() => {}); const { getByText } = render( ); expect(getByText('hello')).not.toBeNull(); }); });