I try to create a class implementation skeleton and a test for it. I have already had the function setResult
and test testSetResult
. Could I have something similar for the function setPublisher
and testSetPublisher
?
class FakeClass {
// ...
public func setResult() -> Result<[String: Any], Error> {
return .success([:])
}
public func setPublisher() -> any Publisher<[String, Any], Error> {
// what should I return? return PassthroughSubject()
}
}
class FakeClassTest: XCTestCase {
// ...
var fakeClass = DependencyInjectionFakeClass() // some dependency injection
func testSetResult() throws {
let result = fakeClass.setResult()
switch result {
case .success(let response):
XCTAsserture(response.isEmpty)
case .failure:
XCTFail()
}
// just a simple fake test
// How could I implement it or do we have sth similar with the function `testSetResult()`
func testSetPublisher() throws {
}
}