feat(drone-dock): 对接订单素材库与点位筛选

This commit is contained in:
2026-10-28 18:08:39 +08:00
parent 06460fe7e6
commit 88fa1f9b77
17 changed files with 2309 additions and 30 deletions
@@ -0,0 +1,21 @@
import UIKit
@testable import suixinkan
/// 首页与完整订单列表的真实素材入口测试,使用独立的只读网络替身。
@MainActor
enum DroneDockMaterialsNavigationFixtures {
/// 构造匹配传入订单的空素材响应,验证跳转后才读取两项接口。
static func controller(context: DroneDockHomeContext, order: DroneDockHomeOrder) throws -> (DroneDockMaterialsViewController, MockURLSession) {
let number = order.orderNumber ?? order.orderID
let detail = try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success",
"data": ["order_number": number, "spot": []]] as [String: Any])
let tasks = try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success",
"data": ["order_number": number, "total": 0, "list": []]] as [String: Any])
let session = MockURLSession(responses: [detail, tasks])
let client = APIClient(environment: .testing, session: session, notificationCenter: NotificationCenter())
client.bindAuthTokenProvider { "materials-navigation-test-token" }
let model = DroneDockMaterialsViewModel(context: context, order: order,
service: DroneDockMaterialsAPI(client: client), currentContext: { context })
return (DroneDockMaterialsViewController(viewModel: model), session)
}
}