Adding a lone, upstream completion case to CombineExt’s WithLatestFromTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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