Adds TESTING.md documenting six tiers (unit / slice / client / storage /
hook / E2E), per-package coverage gates, and the audit of where we
currently sit.
Slice tests in @meshtastic/sdk
- NodeMapper proto round-trip; NodesClient list signal updates.
- ChannelsClient indexes by channel number.
- ConfigClient merges Config + ModuleConfig variants.
- TelemetryClient latest + history per node.
- PositionClient byNode + list.
- ChatClient persistence: hydrate on first subscribe, paginate via
loadOlder, persist inbound messages through the repository. Fixes a
reverse-iteration bug in loadOlder discovered by the new test.
Hook tests in @meshtastic/sdk-react
- New tests/hooks.registry.test.tsx covers useMeshDevice, useNodes,
useNode, useChannels under <MeshRegistryProvider>, plus an active-
client switch round-trip.
Storage tests in @meshtastic/sdk-storage-sqlocal
- migrations.test.ts validates v1 DDL creates messages/nodes/telemetry/
_schema and indexes; CREATE IF NOT EXISTS is idempotent.
- MultiTabCoordinator.broadcast.test.ts proves cross-tab BroadcastChannel
delivery between two coordinators in the same process.
- New vitest.browser.config.ts + tests/sqlocal-opfs.browser.test.ts run
under @vitest/browser (Playwright provider) for real OPFS round-trip
verification. Wired as `pnpm test:browser`. Browser test files end in
`.browser.test.ts` and are excluded from the Node runner.
E2E / firmware-simulator tier (TESTING.md §"E2E / simulator") is scoped
for a follow-up — needs CI Docker for meshtasticd.
Totals after this change:
- @meshtastic/sdk: 36 tests (was 25)
- @meshtastic/sdk-react: 8 tests (was 2)
- @meshtastic/sdk-storage-sqlocal: 12 tests (was 8)
- meshtastic-web: 294 tests (unchanged)
Prevents collision with packages/web's own useDevice() Zustand hook. All
internal exports + tests updated; no behavior change.
Callers migrating off @meshtastic/core should use useMeshDevice() from
@meshtastic/sdk-react going forward.