Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tedgonzalez/bbd7500ccffd2a2ac4c55eb063c7cb7e to your computer and use it in GitHub Desktop.
Save tedgonzalez/bbd7500ccffd2a2ac4c55eb063c7cb7e to your computer and use it in GitHub Desktop.
func testDecodingEmptyArraySucceeds() throws {
let givenJsonData = #"""
[]
"""#.data(using: .utf8)!
let result = try decoder.decode([OrderItem].self, from: givenJsonData)
let expected: [OrderItem] = []
XCTAssertEqual(result, expected)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment