in source/UberRidesTests/ObjectMappingTests.swift [79:92]
func testGetProductBadJSON() {
let bundle = Bundle(for: ObjectMappingTests.self)
if let path = bundle.path(forResource: "getProductID", ofType: "json") {
if let jsonData = try? Data(contentsOf: URL(fileURLWithPath: path)) {
let JSONString = String(data: jsonData, encoding: String.Encoding.utf8)!
// Represent some bad JSON
let jsonData = JSONString.replacingOccurrences(of: "[", with: "").data(using: .utf8)!
let product = try? JSONDecoder.uberDecoder.decode(UberProducts.self, from: jsonData)
XCTAssertNil(product)
}
}
}