import { describe, expect, test } from "bun:test"; import { createCacheStore } from "@/external/storage/cache/createCacheStore.js"; const fakeKv = { get: async () => null, put: async () => undefined, delete: async () => undefined, }; describe("createCacheStore", () => { test("uses KV when a KV namespace is provided", () => { const store = createCacheStore({ kv: fakeKv as unknown as KVNamespace, }); expect(store.metadata.backend).toBe("kv"); expect(store.metadata.consistencyMode).toBe("eventual"); }); test("uses memory when KV is absent", () => { const store = createCacheStore({}); expect(store.metadata.backend).toBe("memory"); expect(store.metadata.consistencyMode).toBe("strong"); }); });