Skip to content

Commit 49f02c4

Browse files
committed
update deps, max out test coverage
1 parent 4954dac commit 49f02c4

File tree

3 files changed

+166
-82
lines changed

3 files changed

+166
-82
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
"markdown-it": "^8.2.2",
1212
"reshape-beautify": "^0.1.2",
1313
"reshape-content": "^0.2.0",
14-
"reshape-eval-code": "^0.3.2",
14+
"reshape-eval-code": "^0.3.3",
1515
"reshape-expressions": "^0.1.5",
1616
"reshape-include": "^1.0.0",
1717
"reshape-layouts": "^1.0.0",
1818
"reshape-minify": "^1.0.0",
1919
"reshape-parser": "^0.2.1",
2020
"reshape-retext": "^1.0.0",
21-
"retext-smartypants": "^2.0.0",
21+
"retext-smartypants": "^3.0.0",
2222
"sugarml": "^0.6.0"
2323
},
2424
"devDependencies": {

test/index.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,35 @@ test('markdownPlugins option', (t) => {
152152
undo()
153153
})
154154

155-
test.only('integration', (t) => {
155+
test('markdownPlugins option with options', (t) => {
156+
const plugins = [[1, 'options']]
157+
function MarkdownIt () {}
158+
MarkdownIt.prototype.use = (plugin, options) => {
159+
t.truthy(plugins[0][0] === plugin)
160+
t.truthy(plugins[0][1] === options)
161+
}
162+
MarkdownIt.prototype.render = () => {}
163+
MarkdownIt.prototype.renderInline = () => {}
164+
const undo = standardRewired.__set__('MarkdownIt', MarkdownIt)
165+
standardRewired({ markdownPlugins: plugins })
166+
undo()
167+
})
168+
169+
test('template option turns off evalCode', (t) => {
170+
const out = standard({ template: true })
171+
const out2 = standard()
172+
t.is(out.plugins[3].name, '')
173+
t.is(out2.plugins[3].name, 'evalCodePlugin')
174+
175+
const markup = fs.readFileSync(path.join(fixtures, 'index.sgr'), 'utf8')
176+
return reshape(out)
177+
.process(markup)
178+
.then((res) => {
179+
t.is(res.output().trim(), '<p>__runtime.escape(“wow <strong>amazing</strong>”)</p>')
180+
})
181+
})
182+
183+
test('integration', (t) => {
156184
const markup = fs.readFileSync(path.join(fixtures, 'index.sgr'), 'utf8')
157185
return reshape(standard())
158186
.process(markup)

0 commit comments

Comments
 (0)