import { describe, expect, test } from "bun:test"; import { expectHit, expectStored, listKeys, purgeAll, requestImage, waitForReady, } from "./helpers.js"; describe("cache prime", () => { test("stores responses in NutsDB and serves hot hits from Otter", async () => { await waitForReady(); await purgeAll(); const miss = await requestImage(103); expect(miss.status).toBe(200); expectStored(miss.cacheStatus); const hit = await requestImage(103); expect(hit.status).toBe(200); expectHit(hit.cacheStatus, "OTTER"); const keys = await listKeys(); expect(keys.some((key) => key.includes("/unsafe/resize:fit:103"))).toBe( true, ); }); });