Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions apps/server/src/orchestration/commandInvariants.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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")]);
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/orchestration/commandInvariants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function invariantError(commandType: string, detail: string): OrchestrationComma
});
}

export function findThreadById(
function findThreadById(
readModel: OrchestrationReadModel,
threadId: ThreadId,
): OrchestrationThread | undefined {
Expand Down
Loading