mirror of
https://github.com/jonasbark/swiftcontrol.git
synced 2026-12-03 10:33:49 +01:00
Add test/integration with platform fakes installed at the plugin seams (UniversalBle.setInstance, NsdPlatformInterface.instance); everything above them — Connection, device classification, protocol parsers, press state machine, keymaps, ProxyDevice — is the real code: - controller_connection_test: scan→classification (Zwift Click/Ride via manufacturer data, Di2 via service UUID, FTMS trainer→ProxyDevice, ignored names/devices), connect lifecycle (device-info reads, battery, RideOn handshake, subscriptions), drops, dedupe, forget list. - controller_button_chain_test: byte-accurate BLE notifications through the full reaction chain — single/double/long press, trigger remapping, duplicate-frame dedupe, unmapped-button error surfacing, multi-button Ride presses. - virtual_shifting_connection_logic_test: retrofit-mode defaults (WiFi / BT-wins / proxy for power meters), auto-connect consent gating, in-place "No connection" disconnect + in-place reconnect, WiFi trainer discovery rules (found/lost/connected-survives-flap, self-exclusion), and an end-to-end Click-press → real action pipeline → gear shift. Protocol-level coverage (DirCon over real TCP, BLE peripheral) lives in the prop submodule's own tests — no prop internals in this repo. Bug fix found by these tests: Connection.disconnect(keepInList: true) was defeated — UniversalBle.disconnect resolves only after the platform disconnect event, so the still-attached connectionStream listener re-entered disconnect() without keepInList and dropped the device, orphaning the object the open details page holds (the exact bug0db8cf0caddressed). Guarded via _inPlaceDisconnects. Also update stale tests to current behavior: sim-mode shifts return Ignored sincee0e4494d(handled by the bridge, not forwarded, logged neutrally), ControllerButton.initials direction arrows, and skip the third BC2 state-machine test consistently with its siblings. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>