Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Always allow test: hold the grant save open before checking the approval waits for it

Bugfixer 2a20ca77496de
diff --git a/src/state/always-allow-save.test.ts b/src/state/always-allow-save.test.ts
index eecc204df2..272b4ca9a5 100644
--- a/src/state/always-allow-save.test.ts
+++ b/src/state/always-allow-save.test.ts
@@ -76,9 +76,13 @@ const alwaysAllow = (onError?: (message: string) => void) => flushSync(() => dis
describe("Always allow on an approval card", () => {
it("saves the grant and then approves the request", async () => {
- saveGrant = () => json({ bot });
+ let finishSave!: (response: Response) => void;
+ saveGrant = () => new Promise((resolve) => { finishSave = resolve; });
alwaysAllow();
await settle();
+ expect(writes).toEqual(["/api/bots/bot/always-allow"]);
+ finishSave(new Response(JSON.stringify({ bot }), { status: 200 }));
+ await settle();
expect(writes).toEqual(["/api/bots/bot/always-allow", "/api/threads/thread/respond"]);
expect(seen.error).toBeNull();
});