Open History to see the last commit
1import { afterEach, describe, expect, it } from "vite-plus/test";
2
3import { appAtomRegistry } from "./atom-registry";
4import {
5 clearThreadComposerErrorsForEnvironment,
6 setThreadComposerError,
7 threadComposerErrorsAtom,
8} from "./thread-composer-error";
9
10afterEach(() => {
11 appAtomRegistry.set(threadComposerErrorsAtom, {});
12});
13
14describe("thread composer errors", () => {
15 it("clears every thread's error for a removed environment and no others", () => {
16 setThreadComposerError("environment-1:thread-1", "one");
17 setThreadComposerError("environment-1:thread-2", "two");
18 setThreadComposerError("environment-10:thread-1", "other environment");
19
20 clearThreadComposerErrorsForEnvironment("environment-1");
21
22 expect(Object.keys(appAtomRegistry.get(threadComposerErrorsAtom))).toEqual([
23 "environment-10:thread-1",
24 ]);
25 });
26});