Trek_CN/client/tests/unit
jubnl b194e8317d
feat(pwa): implement real offline mode with IndexedDB sync
Add genuine offline read/write capability for trips:

- Dexie IndexedDB schema (trips, places, packing, todo, budget,
  reservations, files, mutationQueue, syncMeta, blobCache)
- Repo layer for all domains: offline reads from Dexie, writes
  optimistically to Dexie and enqueue mutations for later replay
- Mutation queue with UUID idempotency keys (X-Idempotency-Key),
  FIFO flush, temp-ID reconciliation on 2xx, fail-and-continue on 4xx
- Trip sync manager: caches all trips with end_date >= today or null,
  auto-evicts 7d after end_date, fetches bundle endpoint in one request
- Map tile prefetcher: bbox from place coords, zooms 10-16, 50MB cap,
  warms SW cache via fetch
- Sync triggers: network online → flush + syncAll; WS reconnect →
  flush only (rate-limiter safe); visibilitychange/30s → flush only
- WS remoteEventHandler writes through to Dexie on every event
- Server idempotency middleware + idempotency_keys table (migration 100,
  24h TTL nightly cleanup)
- GET /api/trips/:id/bundle endpoint for efficient single-request sync
- OfflineBanner component: amber (offline) / blue (syncing) / hidden
- OfflineTab in Settings: cached trip list, re-sync and clear actions
- usePendingMutations hook for per-item pending indicators

Closes #505 #541
2026-04-14 23:04:25 +02:00
..
api fix(tests): use node:buffer.Blob so URL.createObjectURL works on Node 22 2026-04-07 23:54:01 +02:00
db feat(pwa): implement real offline mode with IndexedDB sync 2026-04-14 23:04:25 +02:00
hooks test(front): add test suite frontend (WIP) 2026-04-07 12:31:09 +02:00
i18n test(client): expand frontend test suite to 69.1% coverage 2026-04-07 21:56:08 +02:00
remoteEventHandler test(front): add test suite frontend (WIP) 2026-04-07 12:31:09 +02:00
repo feat(pwa): implement real offline mode with IndexedDB sync 2026-04-14 23:04:25 +02:00
services test: expand frontend test suite to 82% coverage 2026-04-08 21:14:49 +02:00
slices feat(pwa): implement real offline mode with IndexedDB sync 2026-04-14 23:04:25 +02:00
stores fix(pwa): fix offline session redirect and file download auth (#505 #541) 2026-04-14 21:48:25 +02:00
sync feat(pwa): implement real offline mode with IndexedDB sync 2026-04-14 23:04:25 +02:00
utils fix(pwa): fix offline session redirect and file download auth (#505 #541) 2026-04-14 21:48:25 +02:00
tripStore.test.ts feat(pwa): implement real offline mode with IndexedDB sync 2026-04-14 23:04:25 +02:00