func testGetAllProductsBadJSON()

in source/UberRidesTests/ObjectMappingTests.swift [169:182]


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