Commit 3671bd7
Add public API unit tests with ≥80% coverage (#30)
Expand ReliaBLETests to exercise every public method and property on
ReliaBLEManager plus the public value types, closing NFR-2.1 (#30).
- Drive authorization, scanning, discovery, and connection paths through
Nordic's CBMCentralManagerMock via the existing three-target SPM trick
(forceMock: true), with no real CoreBluetooth hardware.
- Unify all tests into a single @suite(.serialized): the process-wide
BluetoothActor singleton and the mock's global state make parallel
execution unsafe (a scan in one test would feed another's discovery
subscriber). A one-shot SimulationConfig registers the simulated
peripheral and pins authorization before any central is created, and
an ensureReady helper re-establishes a known baseline per test, so the
suite is order-independent.
- Cover the public value types directly: BluetoothState.description for
every case, Peripheral/PeripheralDiscoveryEvent id-based equality and
hashing, AdvertisementData typed extraction, ReliaBLEConfig defaults,
and the logging module (LoggingService, LogMessage, OSLogWriter).
- Add CoreBluetoothMock and Willow as test-target dependencies.
Measured coverage of Sources/ReliaBLE/: 91.76% line / 87.89% region
(ReliaBLEManager 100%, BluetoothActor 87.7% line). swift test passes
with zero failures.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 8d8bc78 commit 3671bd7
2 files changed
Lines changed: 622 additions & 100 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
| |||
0 commit comments