Skip to content

Tags: rozd/faketooth

Tags

v1.0.0

Toggle v1.0.0's commit message
feat!: add behavioral fidelity, error simulation, discovery filtering…

…, and cleanup

Features:
- Fire centralManagerDidUpdateState: lazily on first simulated interaction
- Filter scanForPeripherals results by advertised service UUIDs
- Filter discoverServices: and discoverCharacteristics:forService: by UUID
  parameter, with restore-on-nil via _allServices/_allCharacteristics
- Swizzle retrieveConnectedPeripherals(withServices:) to return connected
  simulated peripherals matching service UUIDs
- Add error injection: connectionError, disconnectionError,
  discoverServicesError, discoverCharacteristicsError,
  discoverDescriptorsError on FaketoothPeripheral; readError/writeError
  on FaketoothCharacteristic and FaketoothDescriptor
- Break retain cycles with __weak back-references on _service and
  _characteristic (_peripheral stays strong due to CBPeripheral KVO)

Cleanup:
- Remove dead code: MockPeripheral, MockCentralManager, FaketoothTests
  placeholder, XCTestManifests, LinuxMain, unused randomString helper

Tests (90 total, up from 64):
- ErrorSimulationTest.swift with 13 tests covering all error paths,
  error clearing, and writeError+withoutResponse edge case
- Discovery filtering: non-matching returns empty, nil-after-filter
  restores all (services and characteristics)
- Scan filtering: custom advData without service UUIDs key, multiple
  UUIDs with OR logic
- retrieveConnectedPeripherals: empty services array, multi-service
  peripheral
- centralManagerDidUpdateState: fires exactly once per manager

Docs:
- Update README with error simulation section and behavioral fidelity
  details
- Update CLAUDE.md with current architecture, error simulation, discovery
  filtering, and implementation constraints

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

v0.0.3

Toggle v0.0.3's commit message
Fix multiple bugs: dead nil-guards, missing NSEC_PER_SEC, retain cycl…

…e, per-peripheral cancellation

- Replace C-style cast nil checks with isKindOfClass: guards in connect,
  cancel, setNotify, writeCharacteristic, and writeDescriptor methods
- Fix writeValue:forDescriptor: guarding wrong variable (descriptor vs
  faketoothDescriptor)
- Add missing * NSEC_PER_SEC in setNotifyValue dispatch_after delay
- Break retain cycle in FaketoothCharacteristic notification timer using
  __weak/__strong capture pattern
- Move isConnectionCancelled from per-manager associated object to
  per-peripheral ivar so concurrent connections are independent
- Remove misleading warning log in canContinueFaketoothSimulation that
  fired on every normal non-simulated CoreBluetooth call
- Fix allTests in CBCentralManagerTest (wrong label, incomplete list)
- Fix cancelPeripheralConnectionDelayInSeconds from 1.0s to 0.1s to
  prevent race with 1.0s test timeout
- Fix inverted expectation description in testWriteValueForDescriptor
- Reset FaketoothSettings.delay to defaults in faketoothTearDown()

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

v0.0.2

Toggle v0.0.2's commit message
Merge branch 'feature/tests'

v0.0.1

Toggle v0.0.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Merge pull request #1 from rozd/feature/tests

test: Adds unit tests

0.5.0

Toggle 0.5.0's commit message
Adds possibility to cancel connection to Faketooth peripheral.