Skip to content

Commit 29c12b7

Browse files
committed
Merge branch 'main' into aa/remote-modeling
# Conflicts: # test/prismic.ts
2 parents 774a581 + 876512e commit 29c12b7

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

test/sync.test.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
import { writeFile, mkdir } from "node:fs/promises";
22

33
import { buildCustomType, buildSlice, captureOutput, it } from "./it";
4-
import { deleteCustomType, deleteSlice, insertCustomType, insertSlice } from "./prismic";
4+
import {
5+
deleteCustomType,
6+
deleteSlice,
7+
getCustomTypes,
8+
getSlices,
9+
insertCustomType,
10+
insertSlice,
11+
} from "./prismic";
512

613
it("supports --help", async ({ expect, prismic }) => {
714
const { stdout, exitCode } = await prismic("sync", ["--help"]);
@@ -82,6 +89,10 @@ it("adds new slice to existing library on re-sync", async ({
8289
// Insert a second slice remotely
8390
const sliceB = buildSlice();
8491
await insertSlice(sliceB, { repo, token, host });
92+
await expect.poll(
93+
async () => (await getSlices({ repo, token, host })).map((s) => s.id),
94+
{ timeout: 5_000 },
95+
).toContain(sliceB.id);
8596

8697
// Second sync — should add slice B without breaking slice A
8798
const second = await prismic("sync", ["--repo", repo]);
@@ -114,6 +125,10 @@ it("removes deleted slice and updates index on re-sync", async ({
114125

115126
// Delete slice B from remote
116127
await deleteSlice(sliceB.id, { repo, token, host });
128+
await expect.poll(
129+
async () => (await getSlices({ repo, token, host })).map((s) => s.id),
130+
{ timeout: 5_000 },
131+
).not.toContain(sliceB.id);
117132

118133
// Second sync — should remove slice B and update the index
119134
const second = await prismic("sync", ["--repo", repo]);
@@ -199,6 +214,10 @@ it("removes route when page type is deleted", async ({
199214
await expect(project).toHaveRoute({ type: customType.id });
200215

201216
await deleteCustomType(customType.id, { repo, token, host });
217+
await expect.poll(
218+
async () => (await getCustomTypes({ repo, token, host })).map((ct) => ct.id),
219+
{ timeout: 5_000 },
220+
).not.toContain(customType.id);
202221

203222
// Second sync — removes the route
204223
const second = await prismic("sync", ["--repo", repo]);

0 commit comments

Comments
 (0)