Skip to content

Instantly share code, notes, and snippets.

@thepearl
Created December 11, 2022 23:52
Show Gist options
  • Save thepearl/3e934ee968cbcf16af685b9efe7330c0 to your computer and use it in GitHub Desktop.
Save thepearl/3e934ee968cbcf16af685b9efe7330c0 to your computer and use it in GitHub Desktop.
let expectedOutput = "Hello, World!"
let publisher = SomePublisher<String, Error>()
let cancellable = publisher
.sink(receiveCompletion: { completion in
switch completion {
case .finished:
break
case .failure(let error):
XCTFail("Publisher failed with error: \(error)")
}
}, receiveValue: { value in
XCTAssertEqual(value, expectedOutput)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment