24 lines
1.4 KiB
Swift
24 lines
1.4 KiB
Swift
import UIKit
|
|
@testable import suixinkan
|
|
|
|
/// 继续查看入口的隔离任务页,只允许 MockURLSession 接收同任务 shooting,不配置图传或飞控。
|
|
@MainActor
|
|
enum DroneDockActiveTaskViewFixtures {
|
|
/// 构造时不读接口;页面显示后才发出携带 active_task_id 的只读请求。
|
|
static func controller(taskID: Int, order: DroneDockHomeOrder, context: DroneDockHomeContext) throws
|
|
-> (DroneDockShootingTaskViewController, MockURLSession) {
|
|
let data: [String: Any] = [
|
|
"order_flight_task_id": taskID,
|
|
"order_flight_task": ["id": taskID, "order_number": order.orderID, "scenic_id": context.scenicID],
|
|
"task": ["id": taskID, "status": 20], "ui": ["phase": "shooting", "title": "模拟拍摄中"]
|
|
]
|
|
let body = try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success", "data": data])
|
|
let session = MockURLSession(responses: [body])
|
|
let client = APIClient(environment: .testing, session: session, notificationCenter: NotificationCenter())
|
|
let model = DroneDockShootingTaskViewModel(context: context, taskID: taskID, order: order,
|
|
service: DroneDockShootingAPI(client: client), currentContext: { context })
|
|
let live = DroneDockLiveViewModel(context: context, taskID: taskID, currentContext: { context })
|
|
return (DroneDockShootingTaskViewController(viewModel: model, liveViewModel: live), session)
|
|
}
|
|
}
|