mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-07-07 15:12:18 +08:00
The hooks shipped in 87d1a947a without test coverage or team-facing
mocks. Consumer tests would otherwise need to hand-roll an SWRConfig
wrapper or skip asserting cache-control semantics entirely. This adds:
- Direct unit tests that exercise the real hooks inside a self-provided
SWRConfig (covering key shape, empty-query folding, no-revalidate
writes, non-reactive reads, and read/write round-trip).
- Mock factories in tests/__mocks__/renderer/useDataApi.ts backed by a
shared in-memory Map, plus seedCache/getCachedValue/clearCache
helpers on MockUseDataApiUtils. Registered in MockUseDataApi so the
global renderer setup picks them up without further wiring.
- Docs update in tests/__mocks__/README.md with signatures and usage.