-
Notifications
You must be signed in to change notification settings - Fork 210
Expand file tree
/
Copy pathintegration.test.ts
More file actions
32 lines (28 loc) · 1.38 KB
/
Copy pathintegration.test.ts
File metadata and controls
32 lines (28 loc) · 1.38 KB
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
28
29
30
31
32
import {WriteStreamsMock} from "../../../src/write-streams.js";
import {handler} from "../../../src/handler.js";
import {initSpawnSpy} from "../../mocks/utils.mock.js";
import {WhenStatics} from "../../mocks/when-statics.js";
beforeAll(() => {
initSpawnSpy(WhenStatics.all);
});
test.concurrent("comment-directive-anchor --list", async () => {
const writeStreams = new WriteStreamsMock();
await handler({
cwd: "tests/test-cases/comment-directive-anchor/",
list: true,
noColor: true,
stateDir: ".gitlab-ci-local-comment-directive-anchor",
}, writeStreams);
const descriptionOf = (jobName: string) => {
const line = writeStreams.stdoutLines.find(l => l.startsWith(`${jobName} `));
expect(line, `no output line for job ${jobName}`).toBeDefined();
return line!.slice(jobName.length).trimStart().replace(/\s{2,}.*$/, "");
};
expect(descriptionOf("firstjob")).toBe("Runs first");
expect(descriptionOf("sourcemaps")).toBe("Upload source maps. Opt in per brand:");
expect(descriptionOf("deploy to prod")).toBe("Deploys everything");
expect(descriptionOf("build/image")).toBe("Builds the image");
expect(descriptionOf("quoted job")).toBe("Quoted with a colon: and \"quotes\"");
expect(descriptionOf("single quoted")).toBe("Single quoted job");
expect(descriptionOf("plainjob")).toBe("Runs the tests");
});