Skip to content

Commit 14559f6

Browse files
committed
test: prod builds
1 parent a0dcbff commit 14559f6

File tree

1 file changed

+42
-23
lines changed

1 file changed

+42
-23
lines changed

packages/integrations/markdoc/test/content-collections.test.js

+42-23
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,26 @@ describe('Markdoc - Content Collections', () => {
3333
const res = await fixture.fetch('/collection.json');
3434
const posts = parseDevalue(await res.text());
3535
expect(posts).to.not.be.null;
36-
expect(posts.sort()).to.deep.equal([
37-
simplePostEntry,
38-
{
39-
id: 'with-components.mdoc',
40-
slug: 'with-components',
41-
collection: 'blog',
42-
data: {
43-
schemaWorks: true,
44-
title: 'Post with components',
45-
},
46-
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',
47-
},
48-
{
49-
id: 'with-config.mdoc',
50-
slug: 'with-config',
51-
collection: 'blog',
52-
data: {
53-
schemaWorks: true,
54-
title: 'Post with config',
55-
},
56-
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',
57-
},
58-
]);
36+
expect(posts.sort()).to.deep.equal([simplePostEntry, withComponentsEntry, withConfigEntry]);
37+
});
38+
});
39+
40+
describe('build', () => {
41+
before(async () => {
42+
await fixture.build();
43+
});
44+
45+
it('loads entry', async () => {
46+
const res = await fixture.readFile('/entry.json');
47+
const post = parseDevalue(res);
48+
expect(post).to.deep.equal(simplePostEntry);
49+
});
50+
51+
it('loads collection', async () => {
52+
const res = await fixture.readFile('/collection.json');
53+
const posts = parseDevalue(res);
54+
expect(posts).to.not.be.null;
55+
expect(posts.sort()).to.deep.equal([simplePostEntry, withComponentsEntry, withConfigEntry]);
5956
});
6057
});
6158
});
@@ -70,3 +67,25 @@ const simplePostEntry = {
7067
},
7168
body: '\n## Simple post\n\nThis is a simple Markdoc post.\n',
7269
};
70+
71+
const withComponentsEntry = {
72+
id: 'with-components.mdoc',
73+
slug: 'with-components',
74+
collection: 'blog',
75+
data: {
76+
schemaWorks: true,
77+
title: 'Post with components',
78+
},
79+
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',
80+
};
81+
82+
const withConfigEntry = {
83+
id: 'with-config.mdoc',
84+
slug: 'with-config',
85+
collection: 'blog',
86+
data: {
87+
schemaWorks: true,
88+
title: 'Post with config',
89+
},
90+
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',
91+
};

0 commit comments

Comments
 (0)