Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
test: unit test voidTransportRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
justinemmanuelmercado committed Jul 14, 2020
1 parent a75f674 commit 26d257d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<VoidTransportRequestResponse xmlns="http://mws.amazonaws.com/FulfillmentInboundShipment/2010-10-01/">
<VoidTransportRequestResult>
<TransportResult>
<TransportStatus>VOIDING</TransportStatus>
</TransportResult>
</VoidTransportRequestResult>
<ResponseMetadata>
<RequestId>c5818219-de93-4b3e-8f9b-b172fbacd010</RequestId>
</ResponseMetadata>
</VoidTransportRequestResponse>
26 changes: 26 additions & 0 deletions test/unit/fulfillment-inbound-shipment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,32 @@ const mockInboundShipmentHeader: InboundShipmentHeader = {
}

describe('fulfillmentInboundShipment', () => {
describe('voidTransportRequest', () => {
const parameters = {
ShipmentId: '',
}

it('returns the transport result if voiding is succesful', async () => {
expect.assertions(1)

const mockVoidTransportRequest = createMockHttpClient(
'fulfillment_inbound_shipment_void_transport_request',
)

expect(
await mockVoidTransportRequest.fulfillmentInboundShipment.voidTransportRequest(parameters),
).toMatchSnapshot()
})

it('throws a parsing error when the status response is not valid', async () => {
expect.assertions(1)

await expect(() =>
mockMwsFail.fulfillmentInboundShipment.voidTransportRequest(parameters),
).rejects.toStrictEqual(new ParsingError(parsingError))
})
})

describe('confirmTransportRequest', () => {
const parameters = {
ShipmentId: '',
Expand Down

0 comments on commit 26d257d

Please sign in to comment.