Skip to content

Commit

Permalink
Merge pull request #6 from teufelaudio/automockable-generation
Browse files Browse the repository at this point in the history
Generates automockable for recent peripheral extensions
  • Loading branch information
melle authored May 29, 2024
2 parents d3b30a3 + 60cc709 commit 0f5aef4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Sources/CombineBluetoothMocks/AutoMockable.generated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ open class BluetoothPeripheralMock: BluetoothPeripheral {
set(value) { underlyingIsReadyAgainForWriteWithoutResponse = value }
}
open var underlyingIsReadyAgainForWriteWithoutResponse: AnyPublisher<Void, Never>!
open var proxyDelegate: CBPeripheralDelegate?
open var id: UUID {
get { return underlyingId }
set(value) { underlyingId = value }
Expand Down Expand Up @@ -483,6 +484,22 @@ open class CentralManagerMock: CentralManager {
return connectOptionsClosure.map({ $0(peripheral, options) }) ?? connectOptionsReturnValue
}

//MARK: - peripheral

open var peripheralForCallsCount = 0
open var peripheralForCalled: Bool {
return peripheralForCallsCount > 0
}
open var peripheralForReceivedUuid: UUID?
open var peripheralForReturnValue: BluetoothPeripheral?
open var peripheralForClosure: ((UUID) -> BluetoothPeripheral?)?

open func peripheral(for uuid: UUID) -> BluetoothPeripheral? {
peripheralForCallsCount += 1
peripheralForReceivedUuid = uuid
return peripheralForClosure.map({ $0(uuid) }) ?? peripheralForReturnValue
}

}
open class L2CAPChannelMock: L2CAPChannel {
open var peer: BluetoothPeer {
Expand Down

0 comments on commit 0f5aef4

Please sign in to comment.