I want to make Moya a stub request in Quick / Nimble BDD. Moya has a parameter sampleDatathat I created using the JSON file:
var sampleData: Data {
    switch self {
    case .getPlaces:
        
        guard let path = Bundle.main.path(forResource: "get_places", ofType: "json"),
            let data = Data(base64Encoded: path) else {
                return Data()
        }
        return data
    case .getPlaceDetail:
        
        guard let path = Bundle.main.path(forResource: "get_place_detail", ofType: "json"),
            let data = Data(base64Encoded: path) else {
                return Data()
        }
        return data
    }
}
How can I use this parameter in tests? Any ideas to query Moya in tests?
Thanks!
source
share