From 60cc709a1a8652a4a669725b65ac279eb0773fbd Mon Sep 17 00:00:00 2001 From: Lukas Liebl Date: Wed, 29 May 2024 09:57:20 +0200 Subject: [PATCH] Generates automockable for recent peripheral extensions --- .../AutoMockable.generated.swift | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Sources/CombineBluetoothMocks/AutoMockable.generated.swift b/Sources/CombineBluetoothMocks/AutoMockable.generated.swift index 672a33a..d1ae625 100644 --- a/Sources/CombineBluetoothMocks/AutoMockable.generated.swift +++ b/Sources/CombineBluetoothMocks/AutoMockable.generated.swift @@ -125,6 +125,7 @@ open class BluetoothPeripheralMock: BluetoothPeripheral { set(value) { underlyingIsReadyAgainForWriteWithoutResponse = value } } open var underlyingIsReadyAgainForWriteWithoutResponse: AnyPublisher! + open var proxyDelegate: CBPeripheralDelegate? open var id: UUID { get { return underlyingId } set(value) { underlyingId = value } @@ -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 {