Skip to content

Commit e397a80

Browse files
committed
fix: line endings in test
1 parent f9ebf59 commit e397a80

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

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

+20-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
import { parseHTML } from 'linkedom';
22
import { parse as parseDevalue } from 'devalue';
33
import { expect } from 'chai';
4-
import { loadFixture } from '../../../astro/test/test-utils.js';
4+
import { loadFixture, fixLineEndings } from '../../../astro/test/test-utils.js';
5+
6+
function formatPost(post) {
7+
return {
8+
...post,
9+
body: fixLineEndings(post.body),
10+
};
11+
}
512

613
describe('Markdoc - Content Collections', () => {
714
let fixture;
@@ -26,14 +33,18 @@ describe('Markdoc - Content Collections', () => {
2633
it('loads entry', async () => {
2734
const res = await fixture.fetch('/entry.json');
2835
const post = parseDevalue(await res.text());
29-
expect(post).to.deep.equal(simplePostEntry);
36+
expect(formatPost(post)).to.deep.equal(simplePostEntry);
3037
});
3138

3239
it('loads collection', async () => {
3340
const res = await fixture.fetch('/collection.json');
3441
const posts = parseDevalue(await res.text());
3542
expect(posts).to.not.be.null;
36-
expect(posts.sort()).to.deep.equal([simplePostEntry, withComponentsEntry, withConfigEntry]);
43+
expect(posts.sort().map((post) => formatPost(post))).to.deep.equal([
44+
simplePostEntry,
45+
withComponentsEntry,
46+
withConfigEntry,
47+
]);
3748
});
3849

3950
it('renders content - simple', async () => {
@@ -84,14 +95,18 @@ describe('Markdoc - Content Collections', () => {
8495
it('loads entry', async () => {
8596
const res = await fixture.readFile('/entry.json');
8697
const post = parseDevalue(res);
87-
expect(post).to.deep.equal(simplePostEntry);
98+
expect(formatPost(post)).to.deep.equal(simplePostEntry);
8899
});
89100

90101
it('loads collection', async () => {
91102
const res = await fixture.readFile('/collection.json');
92103
const posts = parseDevalue(res);
93104
expect(posts).to.not.be.null;
94-
expect(posts.sort()).to.deep.equal([simplePostEntry, withComponentsEntry, withConfigEntry]);
105+
expect(posts.sort().map((post) => formatPost(post))).to.deep.equal([
106+
simplePostEntry,
107+
withComponentsEntry,
108+
withConfigEntry,
109+
]);
95110
});
96111

97112
it('renders content - simple', async () => {

0 commit comments

Comments
 (0)