Skip to content

Commit e23e100

Browse files
t3dotggclaude
andcommitted
test(server): favicon TTL test waits for the rescanned path
Each mocked scan returns a new path, so the wait at 15 minutes cannot match the cached path from before expiry. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent b884bd8 commit e23e100

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

‎apps/server/src/project/ProjectEnrichmentService.test.ts‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,17 +351,22 @@ it.effect("rescans a favicon only after 15 minutes", () =>
351351
resolve: (workspaceRoot) => Effect.succeed(identity(workspaceRoot)),
352352
}),
353353
Layer.succeed(ProjectFaviconResolver.ProjectFaviconResolver, {
354+
// Each scan returns a new path, so a wait can tell a rescan from the cached value.
354355
resolvePath: (workspaceRoot) =>
355-
Ref.update(faviconScans, (count) => count + 1).pipe(
356-
Effect.as(`${workspaceRoot}/favicon.svg`),
356+
Ref.updateAndGet(faviconScans, (count) => count + 1).pipe(
357+
Effect.map((scan) => `${workspaceRoot}/favicon-${scan}.svg`),
357358
),
358359
}),
359360
);
360361

361362
yield* Effect.gen(function* () {
362363
const service = yield* ProjectEnrichment.ProjectEnrichmentService;
363364
yield* service.getAvailable("/repo");
364-
yield* waitForAvailable(service, "/repo", (value) => value.faviconPath !== null);
365+
yield* waitForAvailable(
366+
service,
367+
"/repo",
368+
(value) => value.faviconPath === "/repo/favicon-1.svg",
369+
);
365370

366371
// Callers such as the shell stream read projects far more often than this.
367372
for (let minute = 1; minute < 15; minute += 1) {
@@ -372,7 +377,11 @@ it.effect("rescans a favicon only after 15 minutes", () =>
372377

373378
yield* TestClock.adjust("1 minute");
374379
yield* service.getAvailable("/repo");
375-
yield* waitForAvailable(service, "/repo", (value) => value.faviconPath !== null);
380+
yield* waitForAvailable(
381+
service,
382+
"/repo",
383+
(value) => value.faviconPath === "/repo/favicon-2.svg",
384+
);
376385
assert.equal(yield* Ref.get(faviconScans), 2);
377386
}).pipe(Effect.provide(layer(layerMetadata)));
378387
}),

0 commit comments

Comments
 (0)