import { shallow } from 'enzyme'; import { I18n } from 'react-i18nify'; import moment from 'moment'; import Application from './application.component'; describe('', () => { afterEach(() => { I18n.setLocale('en'); }); it("should set I18n locale to locale prop", () => { sinon.spy(I18n, 'setLocale'); const locale = "ca"; shallow(
My application
); expect(I18n.setLocale).to.have.been.calledWith(locale); }); it("should set moment locale to locale prop", () => { sinon.spy(moment, 'locale'); const locale = "ca"; shallow(
My application
); expect(moment.locale).to.have.been.calledWith(locale); }); });