mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.1 KiB
Swift
42 lines
1.1 KiB
Swift
// Copyright © 2023 Rangeproof Pty Ltd. All rights reserved.
|
|
|
|
import Foundation
|
|
|
|
@testable import SessionSnodeKit
|
|
|
|
extension NoResponse: Mocked {
|
|
static var mock: NoResponse = NoResponse()
|
|
}
|
|
|
|
extension Network.BatchSubResponse: MockedGeneric where T: Mocked {
|
|
typealias Generic = T
|
|
|
|
static func mock(type: T.Type) -> Network.BatchSubResponse<T> {
|
|
return Network.BatchSubResponse(
|
|
code: 200,
|
|
headers: [:],
|
|
body: Generic.mock,
|
|
failedToParseBody: false
|
|
)
|
|
}
|
|
}
|
|
|
|
extension Network.BatchSubResponse {
|
|
static func mockArrayValue<M: Mocked>(type: M.Type) -> Network.BatchSubResponse<Array<M>> {
|
|
return Network.BatchSubResponse(
|
|
code: 200,
|
|
headers: [:],
|
|
body: [M.mock],
|
|
failedToParseBody: false
|
|
)
|
|
}
|
|
}
|
|
|
|
extension Network.Destination: Mocked {
|
|
static var mock: Network.Destination = try! Network.Destination.server(
|
|
server: "testServer",
|
|
headers: [:],
|
|
x25519PublicKey: ""
|
|
).withGeneratedUrl(for: MockEndpoint.mock)
|
|
}
|