func testGetPaymentMethods()

in source/UberRidesTests/ObjectMappingTests.swift [691:728]


    func testGetPaymentMethods() {
        let bundle = Bundle(for: ObjectMappingTests.self)
        if let path = bundle.path(forResource: "getPaymentMethods", ofType: "json") {
            if let jsonData = try? Data(contentsOf: URL(fileURLWithPath: path)) {
                guard let paymentMethods = try? JSONDecoder.uberDecoder.decode(PaymentMethods.self, from: jsonData) else {
                    XCTAssert(false)
                    return
                }
                
                XCTAssertEqual(paymentMethods.lastUsed, "f53847de-8113-4587-c307-51c2d13a823c")
                
                guard let payments = paymentMethods.list else {
                    XCTAssert(false)
                    return
                }
                
                XCTAssertEqual(payments.count, 4)
                XCTAssertEqual(payments[0].methodID, "5f384f7d-8323-4207-a297-51c571234a8c")
                XCTAssertEqual(payments[1].methodID, "f33847de-8113-4587-c307-51c2d13a823c")
                XCTAssertEqual(payments[2].methodID, "f43847de-8113-4587-c307-51c2d13a823c")
                XCTAssertEqual(payments[3].methodID, "f53847de-8113-4587-c307-51c2d13a823c")
                
                XCTAssertEqual(payments[0].type, "baidu_wallet")
                XCTAssertEqual(payments[1].type, "alipay")
                XCTAssertEqual(payments[2].type, "visa")
                XCTAssertEqual(payments[3].type, "business_account")
                
                XCTAssertEqual(payments[0].paymentDescription, "***53")
                XCTAssertEqual(payments[1].paymentDescription, "ga***@uber.com")
                XCTAssertEqual(payments[2].paymentDescription, "***23")
                XCTAssertEqual(payments[3].paymentDescription, "Late Night Ride")
                
                return
            }
        }
        
        XCTAssert(false)
    }