Open History to see the last commit
1import { EnvironmentId, type OrchestrationV2ArchivedShellSnapshot } from "@t3tools/contracts";
2import * as Cause from "effect/Cause";
3import { AsyncResult, Atom, AtomRegistry } from "effect/reactivity";
4import { expect, it } from "vite-plus/test";
5
6import {
7 createArchivedThreadSnapshotsAtomFamily,
8 makeArchivedThreadsEnvironmentKey,
9} from "./archivedThreads.ts";
10
11it("does not expose an archived snapshot failure message", () => {
12 const environmentId = EnvironmentId.make("env-sensitive");
13 const snapshotsAtom = createArchivedThreadSnapshotsAtomFamily<Error>({
14 getSnapshotAtom: () =>
15 Atom.make(
16 AsyncResult.failure<OrchestrationV2ArchivedShellSnapshot, Error>(
17 Cause.fail(new Error("credential=secret-value")),
18 ),
19 ),
20 labelPrefix: "test:archived-thread-snapshots",
21 });
22 const registry = AtomRegistry.make();
23
24 expect(registry.get(snapshotsAtom(makeArchivedThreadsEnvironmentKey([environmentId])))).toEqual({
25 snapshots: [],
26 error: "Failed to load archived threads.",
27 isLoading: false,
28 });
29
30 registry.dispose();
31});