test: freeze exec approval expiry

This commit is contained in:
Shakker
2026-05-12 17:04:37 +01:00
parent c0e287f3c1
commit 9be8d38f95

View File

@@ -129,7 +129,10 @@ describe("approval and confirmation modals", () => {
});
it("renders exec approval as a labelled modal", async () => {
vi.useFakeTimers();
vi.setSystemTime(new Date("2026-04-29T00:00:00.000Z"));
render(renderExecApprovalPrompt(createExecState()), container);
vi.useRealTimers();
const { modal, dialog } = await getRenderedDialog();
@@ -140,11 +143,14 @@ describe("approval and confirmation modals", () => {
"Exec approval needed",
);
expect(
modal.shadowRoot?.querySelector("#openclaw-modal-dialog-description")?.textContent,
).toContain("expires in");
modal.shadowRoot?.querySelector("#openclaw-modal-dialog-description")?.textContent?.trim(),
).toBe("expires in 1m");
expect(container.querySelector("#exec-approval-title")?.textContent?.trim()).toBe(
"Exec approval needed",
);
expect(container.querySelector("#exec-approval-description")?.textContent?.trim()).toBe(
"expires in 1m",
);
});
it("renders command spans in exec approvals", async () => {