diff --git a/packages/astro/test/debug-component.test.js b/packages/astro/test/debug-component.test.js new file mode 100644 index 000000000..31a0ff987 --- /dev/null +++ b/packages/astro/test/debug-component.test.js @@ -0,0 +1,29 @@ +import { expect } from 'chai'; +import { loadFixture } from './test-utils.js'; +import os from 'os'; + +// TODO: fix these tests on macOS +const isMacOS = os.platform() === 'darwin'; + +describe('', () => { + if (isMacOS) return; + + /** @type {import('./test-utils').Fixture} */ + let fixture + /** @type {import('./test-utils').DevServer} */ + let devServer; + + before(async () => { + fixture = await loadFixture({ projectRoot: './fixtures/debug-component/' }); + devServer = await fixture.startDevServer(); + }); + + after(async () => { + devServer && await devServer.stop(); + }); + + it('Works in markdown pages', async () => { + const response = await fixture.fetch('/posts/first'); + expect(response.status).to.equal(200); + }); +}); \ No newline at end of file diff --git a/packages/astro/test/fixtures/debug-component/src/data/posts/my-first-post.md b/packages/astro/test/fixtures/debug-component/src/data/posts/my-first-post.md new file mode 100644 index 000000000..e987f5c30 --- /dev/null +++ b/packages/astro/test/fixtures/debug-component/src/data/posts/my-first-post.md @@ -0,0 +1,7 @@ +--- +slug: first +--- + +Whoot! + +# some heading diff --git a/packages/astro/test/fixtures/debug-component/src/pages/index.astro b/packages/astro/test/fixtures/debug-component/src/pages/index.astro new file mode 100644 index 000000000..e69de29bb diff --git a/packages/astro/test/fixtures/debug-component/src/pages/posts/[slug].astro b/packages/astro/test/fixtures/debug-component/src/pages/posts/[slug].astro new file mode 100644 index 000000000..8b6ae00e9 --- /dev/null +++ b/packages/astro/test/fixtures/debug-component/src/pages/posts/[slug].astro @@ -0,0 +1,26 @@ +--- +import Debug from 'astro/debug'; + +// all the content that should be generated +export async function getStaticPaths() { + const data = Astro.fetchContent('../../data/posts/*.md') + + const allArticles = data.map(({ astro, file, url, ...article }) => { + return { + params: { slug: article.slug }, + props: { + article: article, + content: astro.html, + md: astro.source, + } + } + }) + + return allArticles + +} + +const x = Astro.props + +--- +