|
1 |
| -import*asTfrom"../typings/tutorial"; |
2 | 1 | import{validateMarkdown}from"../src/utils/validateMarkdown";
|
3 | 2 |
|
4 | 3 | describe("validate markdown",()=>{
|
5 |
| -it.todo("should return false if missing a summary title (#)"); |
6 |
| -it.todo("should return false if contains multiple `#` headers"); |
7 |
| -it.todo("should return false if missing a summary description"); |
8 |
| -it.todo("should return false if `##` doesn't preface a level"); |
9 |
| -it.todo("should return false if `###` doesn't preface a step"); |
10 |
| -it.todo("should return true for valid markdown"); |
| 4 | +it("should return false if missing a summary title (#)",()=>{ |
| 5 | +constmd=` |
| 6 | +Description. |
| 7 | +
|
| 8 | +## L1 Put Level's title here |
| 9 | +
|
| 10 | +> Level's summary: a short description of the level's content in one line. |
| 11 | +
|
| 12 | +Some text that describes the level`; |
| 13 | +expect(validateMarkdown(md)).toBe(false); |
| 14 | +}); |
| 15 | + |
| 16 | +it("should return false if contains multiple `#` headers",()=>{ |
| 17 | +constmd1=`# A Title |
| 18 | +Description. |
| 19 | +
|
| 20 | +# Another Title |
| 21 | +
|
| 22 | +## L1 Put Level's title here |
| 23 | +
|
| 24 | +> Level's summary: a short description of the level's content in one line. |
| 25 | +
|
| 26 | +Some text that describes the level`; |
| 27 | + |
| 28 | +constmd2=`# A Title |
| 29 | +Description. |
| 30 | +
|
| 31 | +
|
| 32 | +## L1 Put Level's title here |
| 33 | +
|
| 34 | +> Level's summary: a short description of the level's content in one line. |
| 35 | +
|
| 36 | +Some text that describes the level |
| 37 | +
|
| 38 | +# Another title |
| 39 | +`; |
| 40 | +expect(validateMarkdown(md1)).toBe(false); |
| 41 | +expect(validateMarkdown(md2)).toBe(false); |
| 42 | +}); |
| 43 | + |
| 44 | +it("should return false if missing a summary description",()=>{ |
| 45 | +constmd=`# A Title |
| 46 | +
|
| 47 | +## L1 Put Level's title here |
| 48 | +
|
| 49 | +> Level's summary: a short description of the level's content in one line. |
| 50 | +
|
| 51 | +Some text that describes the level |
| 52 | +`; |
| 53 | +expect(validateMarkdown(md)).toBe(false); |
| 54 | +}); |
| 55 | + |
| 56 | +it("should return false if `##` doesn't preface a level",()=>{ |
| 57 | +constmd=`# A Title |
| 58 | +
|
| 59 | +A description |
| 60 | +
|
| 61 | +## Put Level's title here |
| 62 | +
|
| 63 | +> Level's summary: a short description of the level's content in one line. |
| 64 | +
|
| 65 | +Some text that describes the level |
| 66 | +`; |
| 67 | +expect(validateMarkdown(md)).toBe(false); |
| 68 | +}); |
| 69 | + |
| 70 | +it("should return false if `###` doesn't preface a step",()=>{ |
| 71 | +constmd=`# A Title |
| 72 | +
|
| 73 | +A description |
| 74 | +
|
| 75 | +## Put Level's title here |
| 76 | +
|
| 77 | +> Level's summary: a short description of the level's content in one line. |
| 78 | +
|
| 79 | +Some text that describes the level |
| 80 | +
|
| 81 | +### A Step |
| 82 | +
|
| 83 | +First step |
| 84 | +`; |
| 85 | +}); |
| 86 | + |
| 87 | +it("should return true for valid markdown",()=>{ |
| 88 | +constmd=`# Title |
| 89 | +
|
| 90 | +Description. |
| 91 | +
|
| 92 | +## L1 Put Level's title here |
| 93 | +
|
| 94 | +> Level's summary: a short description of the level's content in one line. |
| 95 | +
|
| 96 | +Some text that describes the level |
| 97 | +
|
| 98 | +### L1S1 |
| 99 | +
|
| 100 | +First Step`; |
| 101 | +expect(validateMarkdown(md)).toBe(true); |
| 102 | +}); |
11 | 103 | });
|