Skip to content
Merged
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
10 changes: 9 additions & 1 deletion apps/server/src/usage/UsageService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2214,6 +2214,8 @@ describe("UsageService", () => {

it.live("reports saved usage of a removed directory only for windows it reaches", () =>
Effect.gen(function* () {
// Keep the August fixture inside the 92-day retention window on every run.
yield* TestClock.setTime(Date.parse("2026-08-02T12:00:00Z"));
const { transcript, settings, home } = yield* setup;
yield* Effect.promise(async () => {
await NodeFSP.writeFile(transcript, claudeLine(1, 5));
Expand All @@ -2224,6 +2226,7 @@ describe("UsageService", () => {
Effect.provide(layerService({ prefix: "usage-service-saved-window-test", home, settings })),
);
const first = yield* service.readSummary(WINDOW);
assert.strictEqual(first.buckets.length, 1);
yield* Effect.promise(() =>
NodeFSP.rm(NodePath.join(home, "claude", "projects"), { recursive: true }),
);
Expand All @@ -2240,7 +2243,12 @@ describe("UsageService", () => {
assert.deepStrictEqual(later.buckets, []);
assert.strictEqual(later.sources[0]?.status, "missing");
assert.strictEqual(later.sources[0]?.scannedFiles, 0);
}).pipe(Effect.scoped),

yield* TestClock.adjust(Duration.days(93));
const expired = yield* service.readSummary(WINDOW);
assert.deepStrictEqual(expired.buckets, []);
assert.strictEqual(expired.sources[0]?.status, "missing");
}).pipe(Effect.scoped, Effect.provide(TestClock.layer())),
);

it.live("does not share an in-flight scan after custom prices change", () =>
Expand Down
Loading