diff --git a/diigo-cache/tests/fake-webapp.js b/diigo-cache/tests/fake-webapp.js index 5de3c2d..7badf0b 100644 --- a/diigo-cache/tests/fake-webapp.js +++ b/diigo-cache/tests/fake-webapp.js @@ -1,11 +1,4 @@ -/** - * @file a stand-in for webapp's `WebAppFactory` entrypoint, for tests: an - * auxiliary worker (plain JS — the vitest pool doesn't transform aux - * workers) serving diigo-shaped `load_user_items` pages. 250 items (3 - * pages of 100, the last short), every third private; a few webapp ids - * are known. Counts its diigo calls so tests - * can tell a cache hit (no call) from a miss. - */ +/** @file a stand-in for webapp's `WebAppFactory`, serving diigo-shaped pages to tests. */ import { RpcTarget, WorkerEntrypoint } from "cloudflare:workers"; const KNOWN_WEBAPP = "fake-webapp-id"; @@ -106,6 +99,12 @@ class FakeGet extends RpcTarget { } } +/** + * webapp's `WebAppFactory` entrypoint, faked: an auxiliary worker (plain + * JS; the vitest pool doesn't transform aux workers) serving + * `load_user_items` pages for a few known webapp ids. Counts its diigo + * calls, so tests can tell a cache hit (no call) from a miss. + */ export class WebAppFactory extends WorkerEntrypoint { async at(id) { const kind = { diff --git a/diigo-cache/tests/test-worker.ts b/diigo-cache/tests/test-worker.ts index f1ed024..59ce115 100644 --- a/diigo-cache/tests/test-worker.ts +++ b/diigo-cache/tests/test-worker.ts @@ -1,8 +1,4 @@ -/** - * @file the tests' main module — their edge: the real worker (whose own - * edge supplies the live clock), plus the private cache's logic on a fixed - * clock (bound as CLOCKED_DO in wrangler.tests.jsonc). - */ +/** @file the tests' main module: the real worker plus a fixed-clock cache. */ import { DiigoCacheLogic } from "../src/cache.js"; import type { CacheEnv } from "../src/cache.js"; @@ -13,7 +9,8 @@ export { default } from "../src/index.js"; * never due in real time — tests run it with runDurableObjectAlarm */ export const FIXED_NOW = Date.UTC(2099, 0, 1, 0, 0, 0); -/** a fixed clock that records each sleep it is asked for */ +/** the private cache's logic on a fixed clock that records each sleep it + * is asked for (bound as CLOCKED_DO in wrangler.tests.jsonc) */ export class FixedClockCache extends DiigoCacheLogic { #sleeps: number[] = [];