CombineTest
Set of blocking operators for easy unit testing Apple Combine. API was fully copied from RxBlocking
Don't use these operators in production apps. These operators are only meant for testing purposes.
extension BlockingPublisher {
func toArray() throws -> [Output]
}
extension BlockingPublisher {
func first() throws -> Output?
}
extension BlockingPublisher {
func last() throws -> Output?
}
extension BlockingPublisher {
func single(_ predicate: @escaping (Output) throws -> Bool) throws -> Output?
}
extension BlockingPublisher {
func materialize() -> MaterializedSequenceResult<Output>
}
Installation
CocoaPods
In your Podfile:
pod 'CombineTest'
Swift Package Manager
Create a Package.swift
file.
// swift-tools-version:5.0
import PackageDescription
let package = Package(
name: "CombineTestProject",
dependencies: [
.package(url: "https://github.com/RxSwiftCommunity/CombineTest.git", from: "1.0.0")
],
targets: [
.target(name: "CombineTestProject", dependencies: [CombineTest])
]
)