You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1.Relay only sends a finishing event on deallocation.
but using subscribe<R: Relay>(_ relay: R), the storage subject in the relay received a finishing event.
func testSubscribePublisher() {
var completed = false
relay?
.sink(receiveCompletion: { _ in completed = true },
receiveValue: { self.values.append($0) })
.store(in: &subscriptions)
["1", "2", "3"]
.publisher
.subscribe(relay!)
.store(in: &subscriptions)
XCTAssertFalse(completed)
XCTAssertEqual(values, ["initial", "1", "2", "3"])
// not working, storage subject in the relay is finished
relay!.accept("4")
XCTAssertFalse(completed)
XCTAssertEqual(values, ["initial", "1", "2", "3", "4"])
}
PassthroughRelay doesn’t have an initial value or a buffer of the most recently-published value.
but testSubscribeRelay_CurrentValueToPassthrough test case does not.
func testSubscribeRelay_CurrentValueToPassthrough() {
var completed = false
let input = CurrentValueRelay<String>("initial")
let output = PassthroughRelay<String>()
input
.subscribe(output)
.store(in: &subscriptions)
output
.sink(receiveCompletion: { _ in completed = true },
receiveValue: { self.values.append($0) })
.store(in: &subscriptions)
input.accept("1")
input.accept("2")
input.accept("3")
XCTAssertFalse(completed)
// need to replace with "XCTAssertEqual(values, ["1", "2", "3"])"
XCTAssertEqual(values, ["initial", "1", "2", "3"])
}
1.Relay only sends a finishing event on deallocation.
but using subscribe<R: Relay>(_ relay: R), the storage subject in the relay received a finishing event.
but
testSubscribeRelay_CurrentValueToPassthrough
test case does not.#153
The text was updated successfully, but these errors were encountered: