Skip to content

Commit d7f41c1

Browse files
test(server): cover thread lookup through command invariants
1 parent d2c3e2e commit d7f41c1

2 files changed

Lines changed: 3 additions & 10 deletions

File tree

‎apps/server/src/orchestration/commandInvariants.test.ts‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,7 @@ import {
1111
} from "@t3tools/contracts";
1212
import * as Effect from "effect/Effect";
1313

14-
import {
15-
findThreadById,
16-
listThreadsByProjectId,
17-
requireThread,
18-
requireThreadAbsent,
19-
} from "./commandInvariants.ts";
14+
import { listThreadsByProjectId, requireThread, requireThreadAbsent } from "./commandInvariants.ts";
2015

2116
const now = "2026-01-01T00:00:00.000Z";
2217

@@ -121,9 +116,7 @@ const messageSendCommand: OrchestrationCommand = {
121116
};
122117

123118
describe("commandInvariants", () => {
124-
it("finds threads by id and project", () => {
125-
expect(findThreadById(readModel, ThreadId.make("thread-1"))?.projectId).toBe("project-a");
126-
expect(findThreadById(readModel, ThreadId.make("missing"))).toBeUndefined();
119+
it("lists threads by project", () => {
127120
expect(
128121
listThreadsByProjectId(readModel, ProjectId.make("project-b")).map((thread) => thread.id),
129122
).toEqual([ThreadId.make("thread-2")]);

‎apps/server/src/orchestration/commandInvariants.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function invariantError(commandType: string, detail: string): OrchestrationComma
1818
});
1919
}
2020

21-
export function findThreadById(
21+
function findThreadById(
2222
readModel: OrchestrationReadModel,
2323
threadId: ThreadId,
2424
): OrchestrationThread | undefined {

0 commit comments

Comments
 (0)