Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('setLocale changes the active language of i18next', async function () {
const { sut, eaSpy, mockSignaler } = await createFixture();
await sut.setLocale('de');
eaSpy.methodCalledOnceWith('publish', [Signals.I18N_EA_CHANNEL, { newLocale: 'de', oldLocale: 'en' }]);
const dispatchCall = mockSignaler.calls.find((call) => call[0] === 'dispatchSignal');
assert.notEqual(dispatchCall, undefined);
const [, args] = dispatchCall;
assert.deepEqual(args, Signals.I18N_SIGNAL);
assert.equal(sut.getLocale(), 'de');
});