The best way to control Claude Code, Codex and more from any computer or phone
test(server): pin clock in saved-usage window test (#28603)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Theo Browne committed
Nov 1, 2026 at 02:20 UTC
1280ccd0d2a8525c840999fe633cff20ebdeafd5
1 file changed
+3
-1
apps/server/src/usage/UsageService.test.ts
+3
-1
@@ -2640,6 +2640,8 @@ describe("UsageService", () => {
2640
it.live("reports saved usage of a removed directory only for windows it reaches", () =>
2641
Effect.gen(function* () {
2642
const { transcript, settings, home } = yield* setup;
2643
+ // Saved usage is pruned after the retention window, so pin "now" near the write.
2644
+ yield* TestClock.setTime(Date.parse("2026-08-15T00:00:00Z"));
2645
yield* Effect.promise(async () => {
2646
await NodeFSP.writeFile(transcript, claudeLine(1, 5));
2647
const lastWrite = Date.parse("2026-08-01T10:00:00Z") / 1000;
@@ -2665,7 +2667,7 @@ describe("UsageService", () => {
2667
assert.deepStrictEqual(later.buckets, []);
2668
assert.strictEqual(later.sources[0]?.status, "missing");
2669
assert.strictEqual(later.sources[0]?.scannedFiles, 0);
2668
- }).pipe(Effect.scoped),
2670
+ }).pipe(Effect.scoped, Effect.provide(TestClock.layer())),
2671
);
2672
2673
it.live("does not share an in-flight scan after custom prices change", () =>