import { mount , shallow } from 'enzyme' ; import * as React from 'react' ; import { injectI18n } from './inject' ; import { I18nProvider } from './provider' ; describe ( 'I18nProvider' , ( ) => { test ( 'renders children' , ( ) => { const ChildrenMock = ( ) => null ; const wrapper = shallow ( < I18nProvider > < ChildrenMock /> < /I18nProvider>); expect ( wrapper . children ( ) ) . toMatchSnapshot ( ) ; } ) ; test ( 'provides with context' , ( ) => { const childrenMock = ( ) => < div />; const WithIntl = injectI18n ( childrenMock ) ; const wrapper = mount ( < I18nProvider > < WithIntl /> < /I18nProvider>, { childContextTypes : { intl : { formatMessage : jest . fn ( ) } , } , } ) ; expect ( wrapper . find ( childrenMock ) . prop ( 'intl' ) ) . toMatchSnapshot ( ) ; } ) ; } ) ;