mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-05 00:00:18 -04:00
fix(tools): wrong throw causes test to pass (#64159)
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
@@ -110,6 +110,8 @@ function plugin() {
|
||||
questionNode.children?.[0]?.value === '--text--';
|
||||
if (isStartOfQuestion) {
|
||||
questionTrees.push([questionNode]);
|
||||
} else if (questionTrees.length === 0) {
|
||||
throw Error('question text is missing in questions section');
|
||||
} else {
|
||||
questionTrees[questionTrees.length - 1].push(questionNode);
|
||||
}
|
||||
|
||||
@@ -104,7 +104,9 @@ describe('add-video-question plugin', () => {
|
||||
// 'The md is missing "x"', so it's obvious how to fix things.
|
||||
it('should throw if the subheadings are outside the question heading', () => {
|
||||
expect.assertions(1);
|
||||
expect(() => plugin(videoOutOfOrderAST)).toThrow();
|
||||
expect(() => plugin(videoOutOfOrderAST, file)).toThrow(
|
||||
'question text is missing in questions section'
|
||||
);
|
||||
});
|
||||
|
||||
it('should NOT throw if there is no question', () => {
|
||||
|
||||
Reference in New Issue
Block a user