Skip to content

Commit 3671bd7

Browse files
itsniperclaude
andcommitted
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

File tree

Package.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ let package = Package(
3535
),
3636
.testTarget(
3737
name: "ReliaBLETests",
38-
dependencies: ["ReliaBLEMock"],
38+
dependencies: [
39+
"ReliaBLEMock",
40+
"Willow",
41+
.product(name: "CoreBluetoothMock", package: "IOS-CoreBluetooth-Mock")
42+
],
3943
swiftSettings: [.swiftLanguageMode(.v6), .enableExperimentalFeature("StrictConcurrency")]
4044
),
4145
]

0 commit comments

Comments
 (0)