You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
vitepress/__tests__/e2e/data-loading/data.test.ts

43 lines
1.1 KiB

describe('static data file support in vite 3', () => {
beforeAll(async () => {
await goto('/data-loading/data')
})
test('render correct content', async () => {
expect(await page.textContent('pre#basic')).toMatchInlineSnapshot(`
"[
{
"foo": true
},
{
"bar": true
}
]"
`)
expect(await page.textContent('pre#content')).toMatchInlineSnapshot(`
"[
{
"src": "---\\ntitle: bar\\n---\\n\\nHello\\n\\n---\\n\\nworld\\n",
"html": "<p>Hello</p>\\n<hr>\\n<p>world</p>\\n",
"frontmatter": {
"title": "bar"
},
"excerpt": "<p>Hello</p>\\n",
"url": "/data-loading/content/bar.html",
"transformed": true
},
{
"src": "---\\ntitle: foo\\n---\\n\\nHello\\n\\n---\\n\\nworld\\n",
"html": "<p>Hello</p>\\n<hr>\\n<p>world</p>\\n",
"frontmatter": {
"title": "foo"
},
"excerpt": "<p>Hello</p>\\n",
"url": "/data-loading/content/foo.html",
"transformed": true
}
]"
`)
})
})