Skip to content

Instantly share code, notes, and snippets.

@esilverberg
Created November 24, 2020 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esilverberg/1986f51eb6b27a6733dda1c0fd5cd78c to your computer and use it in GitHub Desktop.
Save esilverberg/1986f51eb6b27a6733dda1c0fd5cd78c to your computer and use it in GitHub Desktop.
// 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