我想在我的Quick/Nimble BDD 测试中发出Moya存根请求。Moya有一个我使用 JSON 文件创建的参数:sampleData
var sampleData: Data {
switch self {
case .getPlaces:
// Provided that project have a file named get_places.json in it's bundle.
guard let path = Bundle.main.path(forResource: "get_places", ofType: "json"),
let data = Data(base64Encoded: path) else {
return Data()
}
return data
case .getPlaceDetail:
// Provided that project have a file named get_place_detail.json in it's bundle.
guard let path = Bundle.main.path(forResource: "get_place_detail", ofType: "json"),
let data = Data(base64Encoded: path) else {
return Data()
}
return data
}
}
如何在测试中使用此参数?在测试中提出Moya存根请求的任何想法?
谢谢!