-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathslice-list.test.ts
More file actions
27 lines (22 loc) · 1011 Bytes
/
slice-list.test.ts
File metadata and controls
27 lines (22 loc) · 1011 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { buildSlice, it } from "./it";
import { insertSlice } from "./prismic";
it("supports --help", async ({ expect, prismic }) => {
const { stdout, exitCode } = await prismic("slice", ["list", "--help"]);
expect(exitCode).toBe(0);
expect(stdout).toContain("prismic slice list [options]");
});
it("lists slices", async ({ expect, prismic, repo, token, host }) => {
const slice = buildSlice();
await insertSlice(slice, { repo, token, host });
const { stdout, exitCode } = await prismic("slice", ["list"]);
expect(exitCode).toBe(0);
expect(stdout).toMatch(new RegExp(`${slice.name}\\s+${slice.id}`));
});
it("lists slices as JSON", async ({ expect, prismic, repo, token, host }) => {
const slice = buildSlice();
await insertSlice(slice, { repo, token, host });
const { stdout, exitCode } = await prismic("slice", ["list", "--json"]);
expect(exitCode).toBe(0);
const parsed = JSON.parse(stdout);
expect(parsed).toEqual(expect.arrayContaining([expect.objectContaining({ id: slice.id })]));
});