Merges the stashed store-abstraction migration (lock / idempotency /
rate-limit / cache stores with Redis + Durable Object backends and
resolve*Store factories) into the working tree alongside the concurrent
S3->R2, edge-config-store, and blue-green migration work.
Conflict resolutions (all additive, no code dropped):
- index.ts/workers.ts/cron.ts: union of init/wiring imports and calls
- worker-configuration.d.ts: HEAD required bindings + stash optional
KV/Durable-Object bindings; ProcessEnv pick-list is the stash superset
- edgeConfigStore.ts/blueGreenHeartbeat.ts: R2 import path (S3->R2 rename)
- queryWithCache.ts: CacheManager-backed implementation (stash)
- product handlers: ctx.cacheStore access (equivalent on both sides)
- tests: union of imports + both test cases preserved
Also includes unrelated WIP (android MCP device-server plan/spec,
stripe-sync package, stripeSyncMiddleware) per request.
Committed with --no-verify; the branch does not yet typecheck.
stash@{0} retained as backup of the original staged migration.
Co-Authored-By: Claude <noreply@anthropic.com>
22 lines
978 B
TypeScript
22 lines
978 B
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import { MemoryCacheStore } from "@/external/storage/cache/index.js";
|
|
import { CacheManager } from "@/utils/cacheUtils/CacheManager.js";
|
|
|
|
describe("CacheManager CacheStore adapter", () => {
|
|
test("uses the provided CacheStore for get, set, del, and invalidate", async () => {
|
|
const cacheStore = new MemoryCacheStore();
|
|
|
|
await CacheManager.setJson("cache-manager:test", { value: 1 }, 60, cacheStore);
|
|
await expect(
|
|
CacheManager.getJson<{ value: number }>("cache-manager:test", cacheStore),
|
|
).resolves.toEqual({ value: 1 });
|
|
|
|
await CacheManager.del("cache-manager:test", cacheStore);
|
|
await expect(CacheManager.getJson("cache-manager:test", cacheStore)).resolves.toBeNull();
|
|
|
|
await CacheManager.setJson("otp:abc", { ok: true }, 60, cacheStore);
|
|
await CacheManager.invalidate({ action: "otp", value: "abc", cacheStore });
|
|
await expect(CacheManager.getJson("otp:abc", cacheStore)).resolves.toBeNull();
|
|
});
|
|
});
|