Skip to content

Commit b007e58

Browse files
committed
test: add unit test for parsed frontmatter in transformer
1 parent c5fae98 commit b007e58

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

test/transformer.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,25 @@ describe("Wrapped transformer and its urlBuilder", () => {
2424
expect(urlBuilder.getFullUrl('d3@7')).toMatchInlineSnapshot(`"https://cdn.example.com/d3@7"`)
2525
})
2626

27+
it("should get parsed frontmatter from transformer", () => {
28+
const content = `---
29+
title: Hello World
30+
markmap:
31+
color: 'red'
32+
---
33+
# Hello World
34+
`
35+
const { frontmatter } = transformer.transform(content)
36+
expect(frontmatter).toMatchInlineSnapshot(`
37+
{
38+
"markmap": {
39+
"color": [
40+
"red",
41+
],
42+
},
43+
"title": "Hello World",
44+
}
45+
`)
46+
})
47+
2748
})

0 commit comments

Comments
 (0)