Created
November 24, 2020 16:52
-
-
Save esilverberg/1986f51eb6b27a6733dda1c0fd5cd78c to your computer and use it in GitHub Desktop.
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
// Define the mock | |
class MatchApiFixture: PSSMatchApiImplementing { | |
public var getMatchStackValue: Result<PSSMatchStack, Error> = .success(PSSMatchStack.fixture!) | |
func getMatchStack() -> SignalProducer<PSSMatchStack, Error> { | |
return SignalProducer(getMatchStackValue) | |
} | |
} | |
// Inject into tests | |
let matchApi = (container.resolve(PSSMatchApiImplementing.self)! as! MatchApiFixture) | |
// For a given test, adjust behavior accordingly | |
beforeEach { | |
let expectedMatchStack = PSSMatchStack(results: [], expires: Date() + TimeInterval(ONE_DAY_IN_SECONDS), maxRefresh: 4, refreshCount: 0) | |
matchApi.getMatchStackValue = Result<PSSMatchStack, Error>.init(success: expectedMatchStack |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment