in source/UberRidesTests/ObjectMappingTests.swift [311:324]
func testGetHistoryBadJSON() {
let bundle = Bundle(for: ObjectMappingTests.self)
if let path = bundle.path(forResource: "getHistory", 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 userActivity = try? JSONDecoder.uberDecoder.decode(TripHistory.self, from: jsonData)
XCTAssertNil(userActivity)
}
}
}