Skip to content

Commit 2b671b1

Browse files
committed
test(server): adapt replay fixtures to current sql types
1 parent 238e140 commit 2b671b1

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

‎apps/server/src/persistence/OrchestrationEventStore.sequence.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ it.effect("fetches the next byte-bounded replay page after delivering the previo
9797
const store = yield* OrchestrationEventStore.OrchestrationEventStore;
9898
const sql = yield* SqlClient.SqlClient;
9999
const threadId = ThreadId.make("byte-paged-replay");
100-
const rows = [1, 2].map((ordinal) => ({
100+
const rows = Arr.map([1, 2] as const, (ordinal) => ({
101101
...eventRow(ordinal, "thread", 2, threadId),
102102
payload_json: encodeJson({
103103
providerSessionId: `session:${ordinal}:${"x".repeat(180_000)}`,

‎apps/server/src/ws.test.ts‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
} from "@t3tools/contracts";
2222
import * as Deferred from "effect/Deferred";
2323
import * as DateTime from "effect/DateTime";
24+
import * as Arr from "effect/Array";
2425
import * as Effect from "effect/Effect";
2526
import * as Exit from "effect/Exit";
2627
import * as Cause from "effect/Cause";
@@ -383,6 +384,7 @@ it.effect.each([
383384
metadata_json: "{}",
384385
application_event_version: 2,
385386
}));
387+
assert(Arr.isArrayNonEmpty(rows));
386388
const inserted = yield* sql<{ sequence: number }>`
387389
INSERT INTO orchestration_events ${sql.insert(rows)} RETURNING sequence
388390
`;
@@ -1323,11 +1325,15 @@ it.effect.each(["thread", "shell"] as const)(
13231325
return Effect.succeed(statement);
13241326
};
13251327
const subscription = Effect.gen(function* () {
1326-
const stream =
1327-
scope === "thread"
1328-
? yield* subscribeOrchestrationV2Thread({ threadId, afterSequence: first!.sequence })
1329-
: yield* subscribeOrchestrationV2Shell({ afterSequence: first!.sequence });
1330-
return yield* Stream.runDrain(stream);
1328+
if (scope === "thread") {
1329+
return yield* subscribeOrchestrationV2Thread({
1330+
threadId,
1331+
afterSequence: first!.sequence,
1332+
}).pipe(Effect.flatMap(Stream.runDrain));
1333+
}
1334+
return yield* subscribeOrchestrationV2Shell({ afterSequence: first!.sequence }).pipe(
1335+
Effect.flatMap(Stream.runDrain),
1336+
);
13311337
}).pipe(
13321338
Effect.provideService(Statement.CurrentTransformer, gateReplayRead),
13331339
Effect.provideService(ThreadManagement.ThreadManagementService, {

0 commit comments

Comments
 (0)