Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions test/unit/miner-governor-kill-switch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,23 @@ describe("recordMinerKillSwitchTransition (#2341)", () => {
expect(rows[0]?.id).toBeLessThan(rows[1]?.id ?? 0);
});

it("a transition with no repoFullName supplied records a null repoFullName, not an omitted or undefined one", () => {
const root = mkdtempSync(join(tmpdir(), "gittensory-miner-governor-kill-switch-no-repo-"));
roots.push(root);
const ledger = initGovernorLedger(join(root, "governor-ledger.sqlite3"));
ledgers.push(ledger);

const tripped = recordMinerKillSwitchTransition(
{ actionClass: "open_pr", previousScope: "none", scope: "global" },
{ append: (event) => ledger.appendGovernorEvent(event) },
);

expect(tripped?.repoFullName).toBeNull();
const rows = ledger.readGovernorEvents({});
expect(rows).toHaveLength(1);
expect(rows[0]?.repoFullName).toBeNull();
});

it("is a no-op and appends nothing when the scope has not changed", () => {
const root = mkdtempSync(join(tmpdir(), "gittensory-miner-governor-kill-switch-noop-"));
roots.push(root);
Expand Down