Skip to content

Instantly share code, notes, and snippets.

@Magomogo
Created April 25, 2016 05:19
Show Gist options
  • Save Magomogo/dc2142e786bb04153a102578b331476d to your computer and use it in GitHub Desktop.
Save Magomogo/dc2142e786bb04153a102578b331476d to your computer and use it in GitHub Desktop.
Shallow + intl
import { shallow } from 'enzyme';
import { SimpleSearch } from '../../src/containers/SimpleSearch';
import { IntlProvider } from 'react-intl';
const intlProvider = new IntlProvider({locale: 'en'}, {});
describe('<SimpleSearch/>', () => {
let wrapper, {intl} = intlProvider.getChildContext();
beforeEach(() => {
wrapper = shallow(<SimpleSearch/>, { context: { intl } });
});
it('renders', () => {
console.log(wrapper.html());
});
});
@stoeffel
Copy link

an example on how to test containers and components enhanced with react-intl is here: stoeffel/react-redux-bp@74af0b8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment