Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Adding a lone, upstream completion case to CombineExt’s WithLatestFromTests.swift
final class WithLatestFromTests: XCTestCase {
//
func testWithLatestFromCompletion() {
let subject1 = PassthroughSubject<Int, Never>()
let subject2 = PassthroughSubject<String, Never>()
var results = [String]()
var completed = false
subscription = subject1
.withLatestFrom(subject2)
.sink(
receiveCompletion: { _ in completed = true },
receiveValue: { results.append($0) }
)
subject1.send(completion: .finished)
XCTAssertTrue(completed) // ❌ “`XCTAssertTrue` failed.”
XCTAssertTrue(results.isEmpty)
}
// Tests for other arities.
func testWithLatestFrom2Completion() {}
func testWithLatestFrom3Completion() {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment