Created
March 28, 2020 12:57
-
-
Save tedgonzalez/c4e7e88ff657a8f2c0cedbd4db85dbb2 to your computer and use it in GitHub Desktop.
This file contains 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", | |
"cost": "100" | |
} | |
] | |
} | |
} | |
] | |
"""#.data(using: .utf8)! | |
XCTAssertThrowsError(try decoder.decode([OrderItem].self, from: givenJsonData)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment