feat(ios): add native app foundation and unsigned ipa build
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import XCTest
|
||||
|
||||
@testable import MultiSimAdmin
|
||||
|
||||
final class ConnectionProbeTests: XCTestCase {
|
||||
func testProbeMapsUpstreamResults() async {
|
||||
let unauthorized = ConnectionProbe(client: MockClient(status: 401))
|
||||
let online = ConnectionProbe(client: MockClient(status: 200))
|
||||
let unavailable = ConnectionProbe(client: MockClient(status: 0))
|
||||
let instance = Self.instance()
|
||||
|
||||
let auth = try? await unauthorized.test(instance)
|
||||
let reachable = try? await online.test(instance)
|
||||
let offline = try? await unavailable.test(instance)
|
||||
|
||||
XCTAssertEqual(auth?.status, .authRequired)
|
||||
XCTAssertEqual(reachable?.status, .online)
|
||||
XCTAssertEqual(offline?.status, .offline)
|
||||
}
|
||||
|
||||
private static func instance() -> Instance {
|
||||
Instance(
|
||||
id: UUID(),
|
||||
name: "Probe",
|
||||
origin: URL(string: "http://192.168.1.20:3000")!,
|
||||
tags: [],
|
||||
groupId: nil,
|
||||
credentialConfigured: false,
|
||||
configRevision: 1,
|
||||
createdAt: Date(),
|
||||
updatedAt: Date()
|
||||
)
|
||||
}
|
||||
|
||||
private struct MockClient: SimAdminClientProtocol {
|
||||
let status: Int
|
||||
|
||||
func send(_: UpstreamRoute, baseURL: URL, cookie: String?) async throws -> UpstreamResponse {
|
||||
if status == 0 {
|
||||
throw UpstreamError.timeout
|
||||
}
|
||||
return UpstreamResponse(status: status, data: Data("{}".utf8))
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user