|
1 | 1 | import { describe, expect, test } from "bun:test"; |
2 | 2 | import type { Type } from "arktype"; |
3 | 3 | import { readCheckPack } from "./check-pack.ts"; |
4 | | -import { decide } from "./decide.ts"; |
5 | 4 | import { exportPolicyFile, policyDifferences } from "./policy-export.ts"; |
6 | 5 | import { checkPolicyFile, readPolicyFile } from "./policy-file.ts"; |
7 | 6 | import { policyWorkflowSchema } from "./policy-workflow.ts"; |
@@ -95,11 +94,17 @@ describe("policy file v4", () => { |
95 | 94 | }); |
96 | 95 | }); |
97 | 96 |
|
98 | | - test("schema 3 actions beside a block that is on never approve or merge when every block was skipped", () => { |
99 | | - const checked = checkPolicyFile(`${RULES}code-review: { on: true }\nactions:\n pass: [{ do: approve }, { do: merge }]\n`, REPO); |
100 | | - if (!checked.ok) throw new Error("the policy file must read"); |
101 | | - const input = { triage: "pass", events: ["opened"], on: ["code-review"], outcomes: { "code-review": { outcome: "skipped" } }, author: ["everyone"] } as const; |
102 | | - expect(decide(checked.workflow!.decide!, input)).toEqual({ do: [{ do: "nothing" }, { do: "nothing" }], rule: 1 }); |
| 97 | + test("schema 3 actions beside a block that is on approve or merge only when every block is clean", () => { |
| 98 | + expect(checkPolicyFile(`${RULES}code-review: { on: true }\nactions:\n pass: [{ do: approve }, { do: merge }]\n`, REPO)).toMatchObject({ |
| 99 | + ok: true, |
| 100 | + workflow: { |
| 101 | + decide: [ |
| 102 | + { if: { triage: "pass", all: "clean" }, do: [{ do: "approve" }, { do: "merge" }] }, |
| 103 | + { if: { triage: "pass" }, do: [{ do: "nothing" }, { do: "nothing" }] }, |
| 104 | + { if: { triage: "fail" }, do: "nothing" }, |
| 105 | + ], |
| 106 | + }, |
| 107 | + }); |
103 | 108 | }); |
104 | 109 |
|
105 | 110 | test("a file that extends another holds no v4 key, and reads with no decide", () => { |
|
0 commit comments