feat: parse translated challenges

Using the English challenge as a source for the seed, solution and tests
this takes the parts that can be translated from the translated version
of the challenge. It also translates known comments in the seed.
This commit is contained in:
Oliver Eyton-Williams
2020-02-24 15:05:18 +01:00
committed by Mrugesh Mohapatra
parent d41e44ebf9
commit 0952ca6bfd
3 changed files with 183 additions and 1 deletions

View File

@ -154,6 +154,19 @@ describe('translation parser', () => {
);
});
it('does not translate urls', () => {
const seed = `http:// Add your code below this line
Add your code above this line `;
expect(translateComments(seed, 'chinese', SIMPLE_TRANSLATION, 'js')).toBe(
seed
);
const seedS = `https:// Add your code below this line
Add your code above this line `;
expect(
translateComments(seedS, 'chinese', SIMPLE_TRANSLATION, 'js')
).toBe(seedS);
});
it('replaces inline English comments with their translations', () => {
const seed = `inline comment // Add your code below this line
Add your code above this line `;