-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.test.js
37 lines (27 loc) · 919 Bytes
/
index.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const Md = require('markdown-it')
const spoiler = require('./index');
const testLoad = require('markdown-it-testgen').load
const path = require('path')
const { test } = require('uvu')
const assert = require('uvu/assert')
const md = Md().use(spoiler, false)
const mdFrontPrior = Md().use(spoiler, true)
testLoad(path.join(__dirname, 'fixtures/default.txt'), data => {
data.fixtures.forEach((fixture, i) =>{
test(`frontPrior false: ${i}`, () => {
const actual = md.render(fixture.first.text)
const expected = fixture.second.text
assert.is(actual, expected)
})
})
})
testLoad(path.join(__dirname, 'fixtures/frontPrior.txt'), data => {
data.fixtures.forEach((fixture, i) =>{
test(`frontPrior true: ${i}`, () => {
const actual = mdFrontPrior.render(fixture.first.text)
const expected = fixture.second.text
assert.is(actual, expected)
})
})
})
test.run()