func testGetTimeEstimatesBadJSON()

in source/UberRidesTests/ObjectMappingTests.swift [210:223]


    func testGetTimeEstimatesBadJSON() {
        let bundle = Bundle(for: ObjectMappingTests.self)
        if let path = bundle.path(forResource: "getTimeEstimates", 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 timeEstimates = try? JSONDecoder.uberDecoder.decode(TimeEstimates.self, from: jsonData)
                XCTAssertNil(timeEstimates)
            }
        }
    }