Skip to content

Commit 76fee53

Browse files
test(tui): pin no-timeout approval gates to wait indefinitely
2 parents cd69a29 + 7116392 commit 76fee53

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

‎src/tui/gate-wire.test.ts‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,6 +1084,37 @@ describe("operator.gate auto-cancel", () => {
10841084
});
10851085
});
10861086

1087+
describe("permission/operator gate with no timeout waits indefinitely", () => {
1088+
test("an unanswered permission gate with no timeoutMs never auto-denies", async () => {
1089+
await withGates(async ({ shell, emitter }) => {
1090+
const settled = settleCapture();
1091+
emitPermission(emitter, { resolve: settled.resolve });
1092+
expect(shell.overlayKind).toBe("permissions");
1093+
1094+
// No timeoutMs was provided, so no auto-deny timer may be armed.
1095+
// After a long wait the gate must still be open and unresolved.
1096+
await new Promise((r) => setTimeout(r, 50));
1097+
expect(settled.get()).toBeUndefined();
1098+
expect(shell.overlayKind).toBe("permissions");
1099+
});
1100+
});
1101+
1102+
test("an unanswered operator gate with no timeoutMs never auto-cancels", async () => {
1103+
await withGates(async ({ shell, emitter }) => {
1104+
const settled = settleCapture();
1105+
emitOperator(emitter, {
1106+
options: ["Yes", "No"],
1107+
resolve: settled.resolve,
1108+
});
1109+
expect(shell.overlayKind).toBe("operator");
1110+
1111+
await new Promise((r) => setTimeout(r, 50));
1112+
expect(settled.get()).toBeUndefined();
1113+
expect(shell.overlayKind).toBe("operator");
1114+
});
1115+
});
1116+
});
1117+
10871118
describe("Esc on a gate overlay settles the awaited promise", () => {
10881119
test("permission.gate: Esc denies instead of abandoning the promise", async () => {
10891120
await withGates(async ({ shell, emitter }) => {

0 commit comments

Comments
 (0)