aboutsummaryrefslogtreecommitdiff
path: root/packages/integrations/markdoc/test
diff options
context:
space:
mode:
authorGravatar Matt Kane <m@mk.gg> 2024-10-04 16:10:34 +0100
committerGravatar Matt Kane <m@mk.gg> 2024-10-04 16:13:51 +0100
commitabf9a89ac1eaec9a8934a68aeebe3c502a3b47eb (patch)
tree7814a2049c31137b51a552d559d889ff1717df0c /packages/integrations/markdoc/test
parent953e6e0f23a1121b1137ca67e675ce9f539ed549 (diff)
downloadastro-abf9a89ac1eaec9a8934a68aeebe3c502a3b47eb.tar.gz
astro-abf9a89ac1eaec9a8934a68aeebe3c502a3b47eb.tar.zst
astro-abf9a89ac1eaec9a8934a68aeebe3c502a3b47eb.zip
Implement legacy collections using glob (#11976)
* feat: support pattern arrays with glob * wip * feat: emulate legacy content collections * Fixes * Lint * Correctly handle legacy data * Fix tests * Switch flag handling * Fix warnings * Add layout warning * Update fixtures * More tests! * Handle empty md files * Lockfile * Dedupe name * Handle data ID unslug * Fix e2e * Clean build * Clean builds in tests * Test fixes * Fix test * Fix typegen * Fix tests * Fixture updates * Test updates * Update changeset * Test * Remove wait in test * Handle race condition * Lock * chore: changes from review * Handle folders without config * lint * Fix test * Update wording for auto-collections * Delete legacyId * Sort another fixture * Rename flag to `legacy.collections` * Apply suggestions from code review Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Changes from review * Apply suggestions from code review Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * lockfile * lock --------- Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Diffstat (limited to 'packages/integrations/markdoc/test')
-rw-r--r--packages/integrations/markdoc/test/content-collections.test.js15
-rw-r--r--packages/integrations/markdoc/test/fixtures/headings-custom/src/content/config.ts7
-rw-r--r--packages/integrations/markdoc/test/fixtures/headings/src/content/config.ts7
-rw-r--r--packages/integrations/markdoc/test/fixtures/image-assets/src/content/config.ts7
-rw-r--r--packages/integrations/markdoc/test/fixtures/render with-space/src/content/config.ts7
-rw-r--r--packages/integrations/markdoc/test/fixtures/render-html/src/content/config.ts7
-rw-r--r--packages/integrations/markdoc/test/fixtures/render-null/src/content/config.ts7
-rw-r--r--packages/integrations/markdoc/test/fixtures/render-partials/src/content/config.ts7
-rw-r--r--packages/integrations/markdoc/test/fixtures/render-simple/src/content/config.ts7
-rw-r--r--packages/integrations/markdoc/test/fixtures/render-typographer/src/content/config.ts7
-rw-r--r--packages/integrations/markdoc/test/fixtures/render-with-components/src/content/config.ts7
-rw-r--r--packages/integrations/markdoc/test/fixtures/render-with-config/src/content/config.ts7
-rw-r--r--packages/integrations/markdoc/test/fixtures/render-with-extends-components/src/content/config.ts7
-rw-r--r--packages/integrations/markdoc/test/fixtures/render-with-indented-components/src/content/config.ts7
14 files changed, 104 insertions, 2 deletions
diff --git a/packages/integrations/markdoc/test/content-collections.test.js b/packages/integrations/markdoc/test/content-collections.test.js
index 16032ce58..48e97d45d 100644
--- a/packages/integrations/markdoc/test/content-collections.test.js
+++ b/packages/integrations/markdoc/test/content-collections.test.js
@@ -13,6 +13,8 @@ function formatPost(post) {
const root = new URL('./fixtures/content-collections/', import.meta.url);
+const sortById = (a, b) => a.id.localeCompare(b.id);
+
describe('Markdoc - Content Collections', () => {
let baseFixture;
@@ -46,7 +48,7 @@ describe('Markdoc - Content Collections', () => {
assert.notEqual(posts, null);
assert.deepEqual(
- posts.sort().map((post) => formatPost(post)),
+ posts.sort(sortById).map((post) => formatPost(post)),
[post1Entry, post2Entry, post3Entry],
);
});
@@ -68,7 +70,7 @@ describe('Markdoc - Content Collections', () => {
const posts = parseDevalue(res);
assert.notEqual(posts, null);
assert.deepEqual(
- posts.sort().map((post) => formatPost(post)),
+ posts.sort(sortById).map((post) => formatPost(post)),
[post1Entry, post2Entry, post3Entry],
);
});
@@ -84,6 +86,9 @@ const post1Entry = {
title: 'Post 1',
},
body: '## Post 1\n\nThis is the contents of post 1.',
+ deferredRender: true,
+ filePath: 'src/content/blog/post-1.mdoc',
+ digest: '5d5bd98d949e2b9a',
};
const post2Entry = {
@@ -95,6 +100,9 @@ const post2Entry = {
title: 'Post 2',
},
body: '## Post 2\n\nThis is the contents of post 2.',
+ deferredRender: true,
+ filePath: 'src/content/blog/post-2.mdoc',
+ digest: '595af4b93a4af072',
};
const post3Entry = {
@@ -106,4 +114,7 @@ const post3Entry = {
title: 'Post 3',
},
body: '## Post 3\n\nThis is the contents of post 3.',
+ deferredRender: true,
+ filePath: 'src/content/blog/post-3.mdoc',
+ digest: 'ef589606e542247e',
};
diff --git a/packages/integrations/markdoc/test/fixtures/headings-custom/src/content/config.ts b/packages/integrations/markdoc/test/fixtures/headings-custom/src/content/config.ts
new file mode 100644
index 000000000..a142ace11
--- /dev/null
+++ b/packages/integrations/markdoc/test/fixtures/headings-custom/src/content/config.ts
@@ -0,0 +1,7 @@
+import { defineCollection } from 'astro:content';
+
+const docs = defineCollection({});
+
+export const collections = {
+ docs,
+};
diff --git a/packages/integrations/markdoc/test/fixtures/headings/src/content/config.ts b/packages/integrations/markdoc/test/fixtures/headings/src/content/config.ts
new file mode 100644
index 000000000..a142ace11
--- /dev/null
+++ b/packages/integrations/markdoc/test/fixtures/headings/src/content/config.ts
@@ -0,0 +1,7 @@
+import { defineCollection } from 'astro:content';
+
+const docs = defineCollection({});
+
+export const collections = {
+ docs,
+};
diff --git a/packages/integrations/markdoc/test/fixtures/image-assets/src/content/config.ts b/packages/integrations/markdoc/test/fixtures/image-assets/src/content/config.ts
new file mode 100644
index 000000000..a142ace11
--- /dev/null
+++ b/packages/integrations/markdoc/test/fixtures/image-assets/src/content/config.ts
@@ -0,0 +1,7 @@
+import { defineCollection } from 'astro:content';
+
+const docs = defineCollection({});
+
+export const collections = {
+ docs,
+};
diff --git a/packages/integrations/markdoc/test/fixtures/render with-space/src/content/config.ts b/packages/integrations/markdoc/test/fixtures/render with-space/src/content/config.ts
new file mode 100644
index 000000000..629486e48
--- /dev/null
+++ b/packages/integrations/markdoc/test/fixtures/render with-space/src/content/config.ts
@@ -0,0 +1,7 @@
+import { defineCollection } from 'astro:content';
+
+const blog = defineCollection({});
+
+export const collections = {
+ blog,
+};
diff --git a/packages/integrations/markdoc/test/fixtures/render-html/src/content/config.ts b/packages/integrations/markdoc/test/fixtures/render-html/src/content/config.ts
new file mode 100644
index 000000000..629486e48
--- /dev/null
+++ b/packages/integrations/markdoc/test/fixtures/render-html/src/content/config.ts
@@ -0,0 +1,7 @@
+import { defineCollection } from 'astro:content';
+
+const blog = defineCollection({});
+
+export const collections = {
+ blog,
+};
diff --git a/packages/integrations/markdoc/test/fixtures/render-null/src/content/config.ts b/packages/integrations/markdoc/test/fixtures/render-null/src/content/config.ts
new file mode 100644
index 000000000..629486e48
--- /dev/null
+++ b/packages/integrations/markdoc/test/fixtures/render-null/src/content/config.ts
@@ -0,0 +1,7 @@
+import { defineCollection } from 'astro:content';
+
+const blog = defineCollection({});
+
+export const collections = {
+ blog,
+};
diff --git a/packages/integrations/markdoc/test/fixtures/render-partials/src/content/config.ts b/packages/integrations/markdoc/test/fixtures/render-partials/src/content/config.ts
new file mode 100644
index 000000000..629486e48
--- /dev/null
+++ b/packages/integrations/markdoc/test/fixtures/render-partials/src/content/config.ts
@@ -0,0 +1,7 @@
+import { defineCollection } from 'astro:content';
+
+const blog = defineCollection({});
+
+export const collections = {
+ blog,
+};
diff --git a/packages/integrations/markdoc/test/fixtures/render-simple/src/content/config.ts b/packages/integrations/markdoc/test/fixtures/render-simple/src/content/config.ts
new file mode 100644
index 000000000..629486e48
--- /dev/null
+++ b/packages/integrations/markdoc/test/fixtures/render-simple/src/content/config.ts
@@ -0,0 +1,7 @@
+import { defineCollection } from 'astro:content';
+
+const blog = defineCollection({});
+
+export const collections = {
+ blog,
+};
diff --git a/packages/integrations/markdoc/test/fixtures/render-typographer/src/content/config.ts b/packages/integrations/markdoc/test/fixtures/render-typographer/src/content/config.ts
new file mode 100644
index 000000000..629486e48
--- /dev/null
+++ b/packages/integrations/markdoc/test/fixtures/render-typographer/src/content/config.ts
@@ -0,0 +1,7 @@
+import { defineCollection } from 'astro:content';
+
+const blog = defineCollection({});
+
+export const collections = {
+ blog,
+};
diff --git a/packages/integrations/markdoc/test/fixtures/render-with-components/src/content/config.ts b/packages/integrations/markdoc/test/fixtures/render-with-components/src/content/config.ts
new file mode 100644
index 000000000..629486e48
--- /dev/null
+++ b/packages/integrations/markdoc/test/fixtures/render-with-components/src/content/config.ts
@@ -0,0 +1,7 @@
+import { defineCollection } from 'astro:content';
+
+const blog = defineCollection({});
+
+export const collections = {
+ blog,
+};
diff --git a/packages/integrations/markdoc/test/fixtures/render-with-config/src/content/config.ts b/packages/integrations/markdoc/test/fixtures/render-with-config/src/content/config.ts
new file mode 100644
index 000000000..629486e48
--- /dev/null
+++ b/packages/integrations/markdoc/test/fixtures/render-with-config/src/content/config.ts
@@ -0,0 +1,7 @@
+import { defineCollection } from 'astro:content';
+
+const blog = defineCollection({});
+
+export const collections = {
+ blog,
+};
diff --git a/packages/integrations/markdoc/test/fixtures/render-with-extends-components/src/content/config.ts b/packages/integrations/markdoc/test/fixtures/render-with-extends-components/src/content/config.ts
new file mode 100644
index 000000000..629486e48
--- /dev/null
+++ b/packages/integrations/markdoc/test/fixtures/render-with-extends-components/src/content/config.ts
@@ -0,0 +1,7 @@
+import { defineCollection } from 'astro:content';
+
+const blog = defineCollection({});
+
+export const collections = {
+ blog,
+};
diff --git a/packages/integrations/markdoc/test/fixtures/render-with-indented-components/src/content/config.ts b/packages/integrations/markdoc/test/fixtures/render-with-indented-components/src/content/config.ts
new file mode 100644
index 000000000..629486e48
--- /dev/null
+++ b/packages/integrations/markdoc/test/fixtures/render-with-indented-components/src/content/config.ts
@@ -0,0 +1,7 @@
+import { defineCollection } from 'astro:content';
+
+const blog = defineCollection({});
+
+export const collections = {
+ blog,
+};