Skip to content
Source
Sign inSign up
pingdotgg/t3code

test: run clock-free live tests on TestClock #35868

Mergedjuliusmarmingemerged 11 commits intomain fromrefs/pull/35868/headmerged by juliusmarminge View on GitHub

Showing 13 changed files with 13 additions and 9 deletions (loading 10).

x
0 of 13 viewed, 13 left
9 additions and 5 deletionsapps/mobile/src/connection/environment-cache-store.test.tsModified
View file
@@ -24,6 +24,7 @@
import * as Logger from "effect/Logger";
import * as Option from "effect/Option";
import * as Schema from "effect/Schema";
+import * as TestClock from "effect/testing/TestClock";
​
import * as MobileDatabase from "../persistence/mobile-database";
import { make } from "./environment-cache-store";
@@ -567,7 +568,7 @@
}),
​
- it.live("returns cached threads before their pull request links, which load after", () =>
+ it.effect("returns cached threads before their pull request links, which load after", () =>
Effect.gen(function* () {
const memory = makeDatabase();
const store = yield* make().pipe(
@@ -592,12 +593,13 @@
​
const shell = Option.getOrThrow(yield* store.loadShell(ENVIRONMENT_ID));
expect(shell.threads.map((thread) => thread.pullRequests)).toEqual([undefined, undefined]);
- const links = yield* shell.loadPullRequests!;
- expect([...links]).toEqual([[THREAD_ID, [link]]]);
+ const links = yield* Effect.forkChild(shell.loadPullRequests!);
+ yield* TestClock.adjust("1 millis");
+ expect([...(yield* Fiber.join(links))]).toEqual([[THREAD_ID, [link]]]);
}),