mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-03 10:01:47 -04:00
Co-authored-by: Mrugesh Mohapatra <1884376+raisedadead@users.noreply.github.com> Co-authored-by: Ahmad Abdolsaheb <ahmad.abdolsaheb@gmail.com>
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import { describe, it, expect, vi, afterEach } from 'vitest';
|
|
|
|
describe('generateGitHubLink', () => {
|
|
afterEach(() => vi.resetModules());
|
|
it('should return a link to a challenge for an english block', async () => {
|
|
vi.doMock('../../config/env.json', () => ({
|
|
default: {
|
|
curriculumLocale: 'english'
|
|
}
|
|
}));
|
|
const { generateGithubLink } = await import('./create-github-link');
|
|
const link = generateGithubLink(
|
|
'5d5a813321b9e3db6c106a46',
|
|
'learn-basic-javascript-by-building-a-role-playing-game'
|
|
);
|
|
|
|
expect(link).toBe(
|
|
'https://github.com/freeCodeCamp/freeCodeCamp/blob/main/curriculum/challenges/english/blocks/learn-basic-javascript-by-building-a-role-playing-game/5d5a813321b9e3db6c106a46.md'
|
|
);
|
|
});
|
|
|
|
it('should return a link for a challenge in the Spanish curriculum', async () => {
|
|
vi.doMock('../../config/env.json', () => ({
|
|
default: {
|
|
curriculumLocale: 'espanol'
|
|
}
|
|
}));
|
|
const { generateGithubLink } = await import('./create-github-link');
|
|
|
|
const link = generateGithubLink(
|
|
'5d5a813321b9e3db6c106a46',
|
|
'learn-basic-javascript-by-building-a-role-playing-game'
|
|
);
|
|
|
|
expect(link).toBe(
|
|
'https://github.com/freeCodeCamp/i18n-curriculum/blob/main/curriculum/challenges/espanol/blocks/learn-basic-javascript-by-building-a-role-playing-game/5d5a813321b9e3db6c106a46.md'
|
|
);
|
|
});
|
|
});
|