一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
27 行
642 B
TypeScript
27 行
642 B
TypeScript
import convertLinksToLocale from './convertLinksToLocale';
|
|
import { Locale } from './types';
|
|
|
|
describe('convertLinksToLocale', () => {
|
|
|
|
it('should convert links', async () => {
|
|
const tests: [string, Partial<Locale>, 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 as Locale);
|
|
expect(actual).toBe(expected);
|
|
}
|
|
});
|
|
|
|
});
|