Skip to content

Commit f11f665

Browse files
committed
moar tests
1 parent 71865e3 commit f11f665

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

test.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const someYaml = '---\nkey: value\nlist:\n - 1\n - 2\n---'
77
const doc = 'Here is a document\nMore of the document\nOther lines\n'
88
const both = someYaml + '\n' + doc
99

10-
test('matter', async function () {
10+
test('matter', async () => {
1111
assert.deepEqual(
1212
Object.keys(await import('vfile-matter')).sort(),
1313
['matter'],
@@ -74,11 +74,18 @@ test('matter', async function () {
7474
{matter: {true: false}},
7575
'should pass yaml options (2)'
7676
)
77+
file = new VFile('---\n\n---\n')
78+
matter(file, {yaml: {version: '1.1'}})
79+
assert.deepEqual(
80+
file.data,
81+
{matter: null},
82+
'should not crash on empty frontmatter'
83+
)
7784
file = new VFile('---\n---\n')
7885
matter(file, {yaml: {version: '1.1'}})
7986
assert.deepEqual(
8087
file.data,
81-
{matter: {}},
88+
{matter: null},
8289
'should not crash on empty frontmatter'
8390
)
8491
})

0 commit comments

Comments
 (0)