提案のために react-intl を調べましたが、酵素の明示的なドキュメントは残っていません。
これが、私がテストを書こうとしてきた方法です。
import {IntlProvider} from 'react-intl';
const intlProvider = new IntlProvider({locale: 'en'}, {});
const intl = intlProvider.getChildContext();
const customMessage = shallow(<CustomMessage />, { options: { context: intl } });
しかし、私はエラーが発生し続けます
不変違反: [React Intl] 必要な
intl
オブジェクトが見つかりませんでした。コンポーネントの祖先に存在する必要があります。
彼らのレポを調べたところ、「react-addons-test-utils」で動作するようになったようです。
私は何か間違ったことをしていますか?