Problem
src/core/utils/lru-cache.ts is shared by transport, gateway, and payment code but has no focused unit test suite. Small changes to eviction or access ordering can therefore affect several unrelated paths without a direct regression failure.
Scope
Add a co-located src/core/utils/lru-cache.test.ts covering the existing behavior:
- inserting and retrieving entries;
- evicting the least-recently-used entry at capacity;
- refreshing recency after
get() and after updating an existing key;
- invoking
onEvict with the evicted key and value;
- supporting an empty-string key without exceeding capacity;
has, delete, clear, size, and entry iteration where useful.
Non-goals
- Do not redesign the cache or make it part of the public SDK API.
- Do not change entry-order semantics without first documenting the intended contract in the PR.
- Keep production changes out of scope unless a test exposes a confirmed defect.
Acceptance criteria
- Tests are deterministic and require no timers, relay, or network.
- Tests are co-located and follow the repository's Bun test conventions.
- Existing tests, lint, and type checking continue to pass.
Verification
bun test src/core/utils/lru-cache.test.ts
bun lint
bun typecheck
Problem
src/core/utils/lru-cache.tsis shared by transport, gateway, and payment code but has no focused unit test suite. Small changes to eviction or access ordering can therefore affect several unrelated paths without a direct regression failure.Scope
Add a co-located
src/core/utils/lru-cache.test.tscovering the existing behavior:get()and after updating an existing key;onEvictwith the evicted key and value;has,delete,clear,size, and entry iteration where useful.Non-goals
Acceptance criteria
Verification
bun test src/core/utils/lru-cache.test.ts bun lint bun typecheck