fix: handle video challenges

This commit is contained in:
Oliver Eyton-Williams
2020-08-13 12:25:53 +02:00
committed by Mrugesh Mohapatra
parent a66455b983
commit 1ec6cf1efd
4 changed files with 96 additions and 32 deletions

View File

@@ -9,9 +9,11 @@ const {
ENGLISH_CHALLENGE,
ENGLISH_CHALLENGE_NO_FILES,
ENGLISH_CHALLENGE_TWO_SOLUTIONS,
ENGLISH_VIDEO_CHALLENGE,
TRANSLATED_CERTIFICATE,
TRANSLATED_CHALLENGE,
WRONG_NUM_TESTS_CHALLENGE
TRANSLATED_VIDEO_CHALLENGE
// WRONG_NUM_TESTS_CHALLENGE
} = require('./__fixtures__/challenge-objects');
const { SIMPLE_TRANSLATION } = require('./__mocks__/mock-comments');
@@ -30,6 +32,11 @@ const COMBINED_CERTIFICATE = mergeChallenges(
TRANSLATED_CERTIFICATE
);
const COMBINED_VIDEO_CHALLENGE = mergeChallenges(
ENGLISH_VIDEO_CHALLENGE,
TRANSLATED_VIDEO_CHALLENGE
);
let logSpy;
describe('translation parser', () => {
@@ -98,11 +105,12 @@ describe('translation parser', () => {
TRANSLATED_CHALLENGE.localeTitle
);
});
it('throws an error if the numbers of tests do not match', () => {
expect(() =>
mergeChallenges(ENGLISH_CHALLENGE, WRONG_NUM_TESTS_CHALLENGE)
).toThrow();
});
// TODO: reinstate this after alpha testing.
// it('throws an error if the numbers of tests do not match', () => {
// expect(() =>
// mergeChallenges(ENGLISH_CHALLENGE, WRONG_NUM_TESTS_CHALLENGE)
// ).toThrow();
// });
it('takes the forum id from the second challenge', () => {
expect(COMBINED_CHALLENGE.forumTopicId).toBe(
TRANSLATED_CHALLENGE.forumTopicId
@@ -130,6 +138,11 @@ describe('translation parser', () => {
false
);
});
it('takes the question from the second challenge', () => {
expect(COMBINED_VIDEO_CHALLENGE.question).toBe(
TRANSLATED_VIDEO_CHALLENGE.question
);
});
});
describe('translateCommentsInChallenge', () => {