Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tedgonzalez/c4e7e88ff657a8f2c0cedbd4db85dbb2 to your computer and use it in GitHub Desktop.
Save tedgonzalez/c4e7e88ff657a8f2c0cedbd4db85dbb2 to your computer and use it in GitHub Desktop.
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