edtechdemo / src /utils /Helpers.test.ts
Hoang Nguyen
init app
f75d7fa
raw
history blame contribute delete
582 Bytes
import { routing } from '@/libs/i18nNavigation';
import { getI18nPath } from './Helpers';
describe('Helpers', () => {
describe('getI18nPath function', () => {
it('should not change the path for default language', () => {
const url = '/random-url';
const locale = routing.defaultLocale;
expect(getI18nPath(url, locale)).toBe(url);
});
it('should prepend the locale to the path for non-default language', () => {
const url = '/random-url';
const locale = 'fr';
expect(getI18nPath(url, locale)).toMatch(/^\/fr/);
});
});
});