This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func testDecodingEmptyArraySucceeds() throws { | |
| let givenJsonData = #""" | |
| [] | |
| """#.data(using: .utf8)! | |
| let result = try decoder.decode([OrderItem].self, from: givenJsonData) | |
| let expected: [OrderItem] = [] | |
| XCTAssertEqual(result, expected) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func testDecodingArrayWithPassengerDeliverySucceeds() throws { | |
| let givenJsonData = #""" | |
| [ | |
| { | |
| "food": { | |
| "date": "2020-01-01", | |
| "restaurantName": "Restaurant", | |
| "totalCost": "8.00", | |
| "orders": [ | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func testDecodingFoodDeliveryWithoutRestaurantThrowsAnError() throws { | |
| let givenJsonData = #""" | |
| [ | |
| { | |
| "food": { | |
| "date": "2020-01-01", | |
| "totalCost": "8.00", | |
| "orders": [ | |
| { | |
| "name": "Pizza", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func testDecodingUnknownOrderItemsThrowsAnError() throws { | |
| let givenJsonData = #""" | |
| [ | |
| "unknownDelivery": "unknownValue" | |
| ] | |
| """#.data(using: .utf8)! | |
| XCTAssertThrowsError(try decoder.decode([OrderItem].self, from: givenJsonData)) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - restore_cache: | |
| key: 1-pods-{{ checksum "Podfile.lock" }} | |
| - run: | |
| name: Install CocoaPods | |
| command: | | |
| if [ ! -d "Pods" ] | |
| then | |
| curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf | |
| bundle exec pod install | |
| fi |
NewerOlder