Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

776 B
Raw Blame
import { describe, expect, it } from "vite-plus/test";

import { activeChatPaletteActions, registerChatPaletteActions } from "./chatActionsRegistry";

const action = (id: string) => ({ id, title: id, searchTerms: [], run: () => {} });

describe("chat actions registry", () => {
  it("publishes the live owner's actions and ignores a stale owner's cleanup", () => {
    const first = Symbol("first");
    const second = Symbol("second");
    const clearFirst = registerChatPaletteActions(first, [action("new")]);
    const clearSecond = registerChatPaletteActions(second, [action("rename")]);
    clearFirst();
    expect(activeChatPaletteActions().map((entry) => entry.id)).toEqual(["rename"]);
    clearSecond();
    expect(activeChatPaletteActions()).toEqual([]);
  });
});