2023-04-23 23:33:15 +02:00
|
|
|
import convertLinksToLocale from './convertLinksToLocale';
|
|
|
|
|
|
|
|
describe('convertLinksToLocale', () => {
|
|
|
|
|
|
|
|
it('should convert links', async () => {
|
2024-04-05 13:16:49 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
2023-04-23 23:33:15 +02:00
|
|
|
const tests: [string, any, string][] = [
|
|
|
|
[
|
|
|
|
'test [link](/help/link)',
|
|
|
|
{ pathPrefix: 'fr' },
|
|
|
|
'test [link](/fr/help/link)',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'test [link](/help/link) [link2](/link2)',
|
|
|
|
{ pathPrefix: 'fr' },
|
|
|
|
'test [link](/fr/help/link) [link2](/fr/link2)',
|
|
|
|
],
|
|
|
|
];
|
|
|
|
|
|
|
|
for (const [input, locale, expected] of tests) {
|
|
|
|
const actual = convertLinksToLocale(input, locale);
|
|
|
|
expect(actual).toBe(expected);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|