Skip to content

Commit 43ce395

Browse files
test: run clock-free live tests on TestClock (#35868)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent e018563 commit 43ce395

13 files changed

Lines changed: 771 additions & 731 deletions

File tree

‎apps/mobile/src/connection/environment-cache-store.test.ts‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import * as Fiber from "effect/Fiber";
2424
import * as Logger from "effect/Logger";
2525
import * as Option from "effect/Option";
2626
import * as Schema from "effect/Schema";
27+
import * as TestClock from "effect/testing/TestClock";
2728

2829
import * as MobileDatabase from "../persistence/mobile-database";
2930
import { make } from "./environment-cache-store";
@@ -567,7 +568,7 @@ describe("mobile SQLite environment cache store", () => {
567568
}),
568569
);
569570

570-
it.live("returns cached threads before their pull request links, which load after", () =>
571+
it.effect("returns cached threads before their pull request links, which load after", () =>
571572
Effect.gen(function* () {
572573
const memory = makeDatabase();
573574
const store = yield* make().pipe(
@@ -592,12 +593,13 @@ describe("mobile SQLite environment cache store", () => {
592593

593594
const shell = Option.getOrThrow(yield* store.loadShell(ENVIRONMENT_ID));
594595
expect(shell.threads.map((thread) => thread.pullRequests)).toEqual([undefined, undefined]);
595-
const links = yield* shell.loadPullRequests!;
596-
expect([...links]).toEqual([[THREAD_ID, [link]]]);
596+
const links = yield* Effect.forkChild(shell.loadPullRequests!);
597+
yield* TestClock.adjust("1 millis");
598+
expect([...(yield* Fiber.join(links))]).toEqual([[THREAD_ID, [link]]]);
597599
}),
598600
);
599601

600-
it.live("keeps cached threads when their pull request links cannot be read", () => {
602+
it.effect("keeps cached threads when their pull request links cannot be read", () => {
601603
const messages: Array<unknown> = [];
602604
const logger = Logger.make(({ message }) => {
603605
messages.push(message);
@@ -633,7 +635,9 @@ describe("mobile SQLite environment cache store", () => {
633635

634636
const shell = Option.getOrThrow(yield* store.loadShell(ENVIRONMENT_ID));
635637
expect(shell.threads.map((thread) => thread.id)).toEqual([THREAD_ID, readable.id]);
636-
expect([...(yield* shell.loadPullRequests!)]).toEqual([[readable.id, [link]]]);
638+
const links = yield* Effect.forkChild(shell.loadPullRequests!);
639+
yield* TestClock.adjust("1 millis");
640+
expect([...(yield* Fiber.join(links))]).toEqual([[readable.id, [link]]]);
637641
expect(messages).toHaveLength(1);
638642
expect(memory.removed).toEqual([]);
639643
}).pipe(Effect.provide(Logger.layer([logger], { mergeWithExisting: false })));

‎apps/server/src/auth/McpOAuth.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ const authorizeParams = (clientId: string, redirect = "http://localhost:51234/ca
193193
resource: `${ORIGIN}/mcp`,
194194
});
195195

196-
it.live("derives discovery metadata from the origin the client reached", () =>
196+
it.effect("derives discovery metadata from the origin the client reached", () =>
197197
withRoutes((handler) =>
198198
Effect.gen(function* () {
199199
const resource = yield* handler(at("/.well-known/oauth-protected-resource/mcp"));
@@ -215,7 +215,7 @@ it.live("derives discovery metadata from the origin the client reached", () =>
215215
),
216216
);
217217

218-
it.live("registers loopback and https clients and never redirects for an unverified client", () =>
218+
it.effect("registers loopback and https clients and never redirects for an unverified client", () =>
219219
withRoutes((handler) =>
220220
Effect.gen(function* () {
221221
for (const refused of [
@@ -622,7 +622,7 @@ it.live("an app approval code approves only an app sign-in, at its own level", (
622622
),
623623
);
624624

625-
it.live(
625+
it.effect(
626626
"sends an app sign-in on the linked tunnel to the hosted app, and a link to its own page",
627627
() =>
628628
Effect.gen(function* () {

‎apps/server/src/mcp/OrchestratorMcpService.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2202,7 +2202,7 @@ describe("OrchestratorMcpService provider resolution", () => {
22022202
}),
22032203
);
22042204

2205-
it.live.each([
2205+
it.effect.each([
22062206
{ name: "parent instance", parentEnabled: true, model: "gpt-5.4" },
22072207
{ name: "alternate instance", parentEnabled: false, model: "gpt-5.5" },
22082208
])(

‎apps/server/src/orchestration-v2/Adapters/ClaudeTaskOutputTail.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ describe("tailClaudeTaskOutput", () => {
101101
).pipe(Effect.provide(NodeServices.layer)),
102102
);
103103

104-
it.live("reads what was written last when the tool result stops it", () =>
104+
it.effect("reads what was written last when the tool result stops it", () =>
105105
Effect.scoped(
106106
Effect.gen(function* () {
107107
const fileSystem = yield* FileSystem.FileSystem;

0 commit comments

Comments
 (0)