mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-03-14 04:00:42 -04:00
test(challenge-parser): improve validate-sections test (#62385)
This commit is contained in:
@@ -124,3 +124,5 @@ function validateSections() {
|
||||
}
|
||||
|
||||
module.exports = validateSections;
|
||||
module.exports.VALID_MARKERS = VALID_MARKERS;
|
||||
module.exports.NON_HEADING_MARKERS = NON_HEADING_MARKERS;
|
||||
|
||||
@@ -4,7 +4,10 @@ import remark from 'remark-parse';
|
||||
import frontmatter from 'remark-frontmatter';
|
||||
|
||||
import addFrontmatter from './add-frontmatter';
|
||||
import validateSections from './validate-sections';
|
||||
import validateSections, {
|
||||
VALID_MARKERS,
|
||||
NON_HEADING_MARKERS
|
||||
} from './validate-sections';
|
||||
|
||||
const processor = unified()
|
||||
.use(remark)
|
||||
@@ -14,107 +17,15 @@ const processor = unified()
|
||||
|
||||
describe('validate-sections plugin', () => {
|
||||
it('should pass when all section markers are valid', () => {
|
||||
const file = `---
|
||||
id: test
|
||||
title: Test
|
||||
---
|
||||
|
||||
# --after-all--
|
||||
After all hook.
|
||||
|
||||
# --after-each--
|
||||
After each hook.
|
||||
|
||||
# --assignment--
|
||||
Assignment.
|
||||
|
||||
# --before-all--
|
||||
Before all hook.
|
||||
|
||||
# --before-each--
|
||||
Before each hook.
|
||||
|
||||
# --description--
|
||||
Text content.
|
||||
|
||||
# --explanation--
|
||||
Explanation.
|
||||
|
||||
# --fillInTheBlank--
|
||||
Fill in blank.
|
||||
|
||||
# --hints--
|
||||
Hints.
|
||||
|
||||
# --instructions--
|
||||
More text.
|
||||
|
||||
# --notes--
|
||||
Notes.
|
||||
|
||||
# --questions--
|
||||
Video questions.
|
||||
|
||||
# --quizzes--
|
||||
Quiz section.
|
||||
|
||||
# --scene--
|
||||
Scene content.
|
||||
|
||||
# --seed--
|
||||
Seed section.
|
||||
|
||||
# --solutions--
|
||||
Solutions.
|
||||
|
||||
# --transcript--
|
||||
Transcript.
|
||||
|
||||
## --answers--
|
||||
Answers.
|
||||
|
||||
## --blanks--
|
||||
Blanks.
|
||||
|
||||
## --quiz--
|
||||
Individual quiz.
|
||||
|
||||
## --seed-contents--
|
||||
Contents here.
|
||||
|
||||
## --sentence--
|
||||
Sentence.
|
||||
|
||||
## --text--
|
||||
Question text.
|
||||
|
||||
## --video-solution--
|
||||
Video solution.
|
||||
|
||||
## --after-user-code--
|
||||
After code.
|
||||
|
||||
## --before-user-code--
|
||||
Before code.
|
||||
|
||||
### --feedback--
|
||||
Feedback.
|
||||
|
||||
### --question--
|
||||
Quiz question.
|
||||
|
||||
#### --answer--
|
||||
Correct answer.
|
||||
|
||||
#### --distractors--
|
||||
Distractors.
|
||||
|
||||
#### --text--
|
||||
Question text.
|
||||
|
||||
--fcc-editable-region--
|
||||
Editable region.
|
||||
`;
|
||||
const file = [
|
||||
'---',
|
||||
'id: test',
|
||||
'title: Test',
|
||||
'---',
|
||||
'',
|
||||
...VALID_MARKERS.map(marker => `${marker}\nDummy content.`),
|
||||
...NON_HEADING_MARKERS.map(marker => `${marker}\nDummy content.`)
|
||||
].join('\n');
|
||||
|
||||
expect(() => {
|
||||
processor.runSync(processor.parse(file));
|
||||
|
||||
Reference in New Issue
Block a user