Skip to content

Commit

Permalink
Implements AuthClientProtocolMock
Browse files Browse the repository at this point in the history
  • Loading branch information
DeluxeAlonso committed Sep 15, 2023
1 parent fe208d7 commit f8a97f4
Showing 1 changed file with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,35 @@
// Created by Alonso on 14/09/23.
//

import Foundation
import UpcomingMoviesDomain

final class AuthClientProtocolMock: AuthClientProtocol {

var getRequestTokenResult: Result<RequestTokenResult, APIError>?
private(set) var getRequestTokenCallCount = 0
func getRequestToken(with readAccessToken: String, completion: @escaping (Result<RequestTokenResult, APIError>) -> Void) {
if let getRequestTokenResult = getRequestTokenResult {
completion(getRequestTokenResult)
}
getRequestTokenCallCount += 1
}

var getAccessTokenResult: Result<AccessToken, APIError>?
private(set) var getAccessTokenCallCount = 0
func getAccessToken(with readAccessToken: String, requestToken: String, completion: @escaping (Result<AccessToken, APIError>) -> Void) {
if let getAccessTokenResult = getAccessTokenResult {
completion(getAccessTokenResult)
}
getAccessTokenCallCount += 1
}

var createSessionIdResult: Result<SessionResult, APIError>?
private(set) var createSessionIdCallCount = 0
func createSessionId(with accessToken: String, completion: @escaping (Result<SessionResult, APIError>) -> Void) {
if let createSessionIdResult = createSessionIdResult {
completion(createSessionIdResult)
}
createSessionIdCallCount += 1
}

}

0 comments on commit f8a97f4

Please sign in to comment.