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) } }