test(server): cover thread lookup through command invariants (#9978)

This commit is contained in:
Julius Marminge authored and GitHub committed 2026-09-05 00:12:26 -07:00
1 parent 5fe29c8945
commit b3f8dd979a
2 files changed
+3 -10

No files matched your search

@@ -11,12 +11,7 @@ import {
} from "@t3tools/contracts";
import * as Effect from "effect/Effect";
import {
findThreadById,
listThreadsByProjectId,
requireThread,
requireThreadAbsent,
} from "./commandInvariants.ts";
import { listThreadsByProjectId, requireThread, requireThreadAbsent } from "./commandInvariants.ts";
const now = "2026-01-01T00:00:00.000Z";
@@ -121,9 +116,7 @@ const messageSendCommand: OrchestrationCommand = {
};
describe("commandInvariants", () => {
it("finds threads by id and project", () => {
expect(findThreadById(readModel, ThreadId.make("thread-1"))?.projectId).toBe("project-a");
expect(findThreadById(readModel, ThreadId.make("missing"))).toBeUndefined();
it("lists threads by project", () => {
expect(
listThreadsByProjectId(readModel, ProjectId.make("project-b")).map((thread) => thread.id),
).toEqual([ThreadId.make("thread-2")]);
@@ -18,7 +18,7 @@ function invariantError(commandType: string, detail: string): OrchestrationComma
});
}
export function findThreadById(
function findThreadById(
readModel: OrchestrationReadModel,
threadId: ThreadId,
): OrchestrationThread | undefined {