Files
CherryHQ-cherry-studio/tests
fullex 9d1e65c32f test(data-api): add useReadCache/useWriteCache coverage and shared mocks
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.
2026-04-21 04:21:23 -07:00
..