test: prod builds

This commit is contained in:
bholmesdev 2023-02-10 09:01:10 -05:00
parent 39676acc50
commit 260bde4054

View file

@ -33,29 +33,26 @@ describe('Markdoc - Content Collections', () => {
const res = await fixture.fetch('/collection.json'); const res = await fixture.fetch('/collection.json');
const posts = parseDevalue(await res.text()); const posts = parseDevalue(await res.text());
expect(posts).to.not.be.null; expect(posts).to.not.be.null;
expect(posts.sort()).to.deep.equal([ expect(posts.sort()).to.deep.equal([simplePostEntry, withComponentsEntry, withConfigEntry]);
simplePostEntry, });
{ });
id: 'with-components.mdoc',
slug: 'with-components', describe('build', () => {
collection: 'blog', before(async () => {
data: { await fixture.build();
schemaWorks: true, });
title: 'Post with components',
}, it('loads entry', async () => {
body: '\n## Post with components\n\nThis uses a custom marquee component with a shortcode:\n\n{% mq direction="right" %}\nI\'m a marquee too!\n{% /mq %}\n\nAnd a code component for code blocks:\n\n```js\nconst isRenderedWithShiki = true;\n```\n', const res = await fixture.readFile('/entry.json');
}, const post = parseDevalue(res);
{ expect(post).to.deep.equal(simplePostEntry);
id: 'with-config.mdoc', });
slug: 'with-config',
collection: 'blog', it('loads collection', async () => {
data: { const res = await fixture.readFile('/collection.json');
schemaWorks: true, const posts = parseDevalue(res);
title: 'Post with config', expect(posts).to.not.be.null;
}, expect(posts.sort()).to.deep.equal([simplePostEntry, withComponentsEntry, withConfigEntry]);
body: '\n## Post with config\n\nThis uses a shortcode to render a marquee element,\nwith a variable to show and hide:\n\n{% if $showMarquee %}\n{% mq direction="down" %}\nIm a marquee!\n{% /mq %}\n{% /if %}\n',
},
]);
}); });
}); });
}); });
@ -70,3 +67,25 @@ const simplePostEntry = {
}, },
body: '\n## Simple post\n\nThis is a simple Markdoc post.\n', body: '\n## Simple post\n\nThis is a simple Markdoc post.\n',
}; };
const withComponentsEntry = {
id: 'with-components.mdoc',
slug: 'with-components',
collection: 'blog',
data: {
schemaWorks: true,
title: 'Post with components',
},
body: '\n## Post with components\n\nThis uses a custom marquee component with a shortcode:\n\n{% mq direction="right" %}\nI\'m a marquee too!\n{% /mq %}\n\nAnd a code component for code blocks:\n\n```js\nconst isRenderedWithShiki = true;\n```\n',
};
const withConfigEntry = {
id: 'with-config.mdoc',
slug: 'with-config',
collection: 'blog',
data: {
schemaWorks: true,
title: 'Post with config',
},
body: '\n## Post with config\n\nThis uses a shortcode to render a marquee element,\nwith a variable to show and hide:\n\n{% if $showMarquee %}\n{% mq direction="down" %}\nIm a marquee!\n{% /mq %}\n{% /if %}\n',
};