test(app): broaden frontend coverage (batch 2) — hooks #45
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "test/app-coverage-batch-2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Batch 2 of frontend coverage — the three app hooks, which had zero tests. +16 tests.
What's covered
useAuthloading→authenticatedon a 200/auth/me; →unauthenticatedon 401 and on unexpected (500) errors (the no-infinite-loop fallback).useTheme'system', persisted read fromlocalStorage,dark/lightclass +localStorageside effects, and'system'resolving to the OS preference both ways (overriding thematchMediapolyfill).useOfflineQueueenqueueassignsid/queued_atand persists (verified by surviving a remount);syncPOSTs queued entries with the right body and clears them on success; leaves items on a network failure or a non-ok response; auto-flushes on thewindowonlineevent.Notes
fake-indexeddb(^6.0.0) — jsdom has no IndexedDB, anduseOfflineQueueis built on it. Each test gets a freshIDBFactoryfor isolation. This is the only production-adjacent change; no app code touched.act()warnings.app/package.json, where batch 1 made no change, so no conflict.Remaining coverage targets for a possible batch 3: higher-traffic pages (
EntryListPage/EntryDetailPage) against a mockedapi, andlib/useMetaTags.🤖 Generated with Claude Code