Skip to content

Commit

Permalink
Add mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisabhash committed Nov 28, 2023
1 parent 8bf2493 commit e7752e4
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// Copyright Amazon.com Inc. or its affiliates.
// All Rights Reserved.
//
// SPDX-License-Identifier: Apache-2.0
//

import Foundation
@testable import AWSCognitoAuthPlugin

class MockURLSessionClient: URLSessionClientBehavior {

public var cancelAndResetCallCount = 0
public var dataForURLRequestCallCount = 0
public var dataForURLCallCount = 0

func cancelAndReset() async {
cancelAndResetCallCount += 1
}

func data(for request: URLRequest, delegate: (URLSessionTaskDelegate)?) async throws -> (Data, URLResponse) {
dataForURLRequestCallCount += 1
return (Data(), HTTPURLResponse())
}

func data(from url: URL, delegate: (URLSessionTaskDelegate)?) async throws -> (Data, URLResponse) {
dataForURLCallCount += 1
return (Data(), HTTPURLResponse())
}

}

0 comments on commit e7752e4

Please sign in to comment.