Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ struct WooShippingUpdateShipmentMapper: Mapper {
///
func map(response: Data) throws -> WooShippingShipments {
let decoder = JSONDecoder()
if hasDataEnvelope(in: response) {
do {
return try decoder.decode(WooShippingUpdateShipmentResponseEnvelope.self, from: response).data.shipments
} else {
} catch {
return try decoder.decode(WooShippingUpdateShipmentResponse.self, from: response).shipments
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class WooShippingUpdateShipmentMapperTests: XCTestCase {
}

func test_shipments_are_properly_parsed_when_response_has_no_data_envelope() throws {
guard let shipments = mapLoadShippingLabelConfig() else {
guard let shipments = mapLoadShippingLabelConfigWithoutDataEnvelope() else {
XCTFail()
return
}
Expand Down