diff options
Diffstat (limited to 'packages/astro/test/plain-markdown.test.js')
-rw-r--r-- | packages/astro/test/plain-markdown.test.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/packages/astro/test/plain-markdown.test.js b/packages/astro/test/plain-markdown.test.js new file mode 100644 index 000000000..8e2f1a2ec --- /dev/null +++ b/packages/astro/test/plain-markdown.test.js @@ -0,0 +1,38 @@ +import { suite } from 'uvu'; +import * as assert from 'uvu/assert'; +import { doc } from './test-utils.js'; +import { setup, setupBuild } from './helpers.js'; + +const Markdown = suite('Plain Markdown tests'); + +setup(Markdown, './fixtures/plain-markdown'); +setupBuild(Markdown, './fixtures/plain-markdown'); + +Markdown('Can load a simple markdown page with Astro', async ({ runtime }) => { + const result = await runtime.load('/post'); + + assert.equal(result.statusCode, 200); + + const $ = doc(result.contents); + + assert.equal($('p').first().text(), 'Hello world!'); + assert.equal($('#first').text(), 'Some content'); + assert.equal($('#interesting-topic').text(), 'Interesting Topic'); +}); + +Markdown('Can load a realworld markdown page with Astro', async ({ runtime }) => { + const result = await runtime.load('/realworld'); + if (result.error) throw new Error(result.error); + + assert.equal(result.statusCode, 200); + const $ = doc(result.contents); + + assert.equal($('pre').length, 7); +}); + +Markdown('Builds markdown pages for prod', async (context) => { + await context.build(); +}); + + +Markdown.run(); |