Skip to content

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

Test the full open sequence and the not-found notice for web thread links

Purv Kabaria7a00ca1c5570
diff --git a/src/hooks/use-external-chat-links.test.ts b/src/hooks/use-external-chat-links.test.ts
index c616f93272..0411414b4f 100644
--- a/src/hooks/use-external-chat-links.test.ts
+++ b/src/hooks/use-external-chat-links.test.ts
@@ -91,10 +91,22 @@ describe("useExternalChatLinks", () => {
expect(dispatch).not.toHaveBeenCalled();
render(loaded, dispatch);
- expect(dispatch).toHaveBeenCalled();
+ expect(dispatch.mock.calls.map(([action]) => action)).toEqual([
+ { type: "select", id: "scout" },
+ { type: "switchTask", botId: "scout", threadId: "scout-main" },
+ { type: "revealThread", threadId: "scout-main" },
+ ]);
expect(fixture.link).toBeNull();
});
+ it("says so when the web address names a thread this person can't see", () => {
+ vi.stubGlobal("window", { location: { pathname: "/", search: "?thread=elsewhere", hash: "" }, history: { replaceState: vi.fn() } });
+ const dispatch = vi.fn();
+ render(loading, dispatch);
+ render(loaded, dispatch);
+ expect(dispatch.mock.calls.map(([action]) => action)).toContainEqual({ type: "notice", notice: { kind: "thread-gone", botName: null } });
+ });
+
it("does nothing without the desktop bridge", () => {
vi.stubGlobal("window", {});
const dispatch = vi.fn();