diff --git a/tools/challenge-md-parser/__snapshots__/text-to-data.test.js.snap b/tools/challenge-md-parser/__snapshots__/text-to-data.test.js.snap index 98b906904f..0fd00e173c 100644 --- a/tools/challenge-md-parser/__snapshots__/text-to-data.test.js.snap +++ b/tools/challenge-md-parser/__snapshots__/text-to-data.test.js.snap @@ -12,8 +12,6 @@ Object {

<p>We aim to preserve this</p>
 

", - "instructions": "
-

To pass the test on this challenge, change your h1 element's text to say \\"Hello World\\".

-
", + "instructions": "", } `; diff --git a/tools/challenge-md-parser/fixtures/challenge-html-ast.json b/tools/challenge-md-parser/fixtures/challenge-html-ast.json index 4bf20a220c..b11e907cc5 100644 --- a/tools/challenge-md-parser/fixtures/challenge-html-ast.json +++ b/tools/challenge-md-parser/fixtures/challenge-html-ast.json @@ -397,80 +397,6 @@ "type": "text", "value": "\n" }, - { - "type": "element", - "tagName": "p", - "properties": {}, - "children": [ - { - "type": "text", - "value": "To pass the test on this challenge, change your ", - "position": { - "start": { - "line": 27, - "column": 1, - "offset": 489 - }, - "end": { - "line": 27, - "column": 49, - "offset": 537 - } - } - }, - { - "type": "element", - "tagName": "code", - "properties": {}, - "children": [ - { - "type": "text", - "value": "h1" - } - ], - "position": { - "start": { - "line": 27, - "column": 49, - "offset": 537 - }, - "end": { - "line": 27, - "column": 53, - "offset": 541 - } - } - }, - { - "type": "text", - "value": " element's text to say \"Hello World\".", - "position": { - "start": { - "line": 27, - "column": 53, - "offset": 541 - }, - "end": { - "line": 27, - "column": 90, - "offset": 578 - } - } - } - ], - "position": { - "start": { - "line": 27, - "column": 1, - "offset": 489 - }, - "end": { - "line": 27, - "column": 90, - "offset": 578 - } - } - }, { "type": "text", "value": "\n" diff --git a/tools/challenge-md-parser/text-to-data.test.js b/tools/challenge-md-parser/text-to-data.test.js index 3281f42044..9780a4b477 100644 --- a/tools/challenge-md-parser/text-to-data.test.js +++ b/tools/challenge-md-parser/text-to-data.test.js @@ -54,6 +54,13 @@ describe('text-to-data', () => { expect(file.data[expectedField].includes(expectedText)).toBe(true); }); + // eslint-disable-next-line max-len + it('should add an empty string relating to the section id without data to `file.data`', () => { + const plugin = textToData([otherExpectedField]); + plugin(mockAST, file); + expect(file.data[otherExpectedField]).toEqual(''); + }); + it('should preserve nested html', () => { const plugin = textToData([expectedField]); plugin(mockAST, file);