Skip to content

Commit c8c85c4

Browse files
committed
adding spec
1 parent 6e364c6 commit c8c85c4

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

spec/muffin_man/fulfillment_inbound/v0_spec.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,4 +213,21 @@
213213
expect(JSON.parse(response.body).dig("payload", "TransportResult", "TransportStatus")).not_to be_empty
214214
end
215215
end
216+
217+
describe "get_shipment_items" do
218+
before { stub_get_shipment_items }
219+
let(:query_type) { "DATE_RANGE" }
220+
let(:marketplace_id) { "ATVPDKIKX0DER" }
221+
let(:last_updated_after) { "2022-09-30T00:00:00Z" }
222+
let(:last_updated_before) { "2022-10-01T00:00:00Z" }
223+
224+
it "makes a request to get shipment items with all parameters" do
225+
response = fba_inbound_client.get_shipment_items(query_type, marketplace_id,
226+
last_updated_after: last_updated_after,
227+
last_updated_before: last_updated_before)
228+
expect(response.response_code).to eq(200)
229+
expect(JSON.parse(response.body).dig("payload", "ItemData")).not_to be_empty
230+
expect(JSON.parse(response.body).dig("payload", "NextToken")).not_to be_nil
231+
end
232+
end
216233
end

spec/support/sp_api_helpers.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,11 @@ def stub_get_shipment_items_by_shipment_id
332332
.to_return(status: 200, body: File.read("./spec/support/get_shipment_items_by_shipment_id_v0.json"), headers: {})
333333
end
334334

335+
def stub_get_shipment_items
336+
stub_request(:get, "https://#{hostname}/fba/inbound/v0/shipmentItems?MarketplaceId=#{marketplace_id}&QueryType=#{query_type}")
337+
.to_return(status: 200, body: File.read("./spec/support/get_shipment_items_by_shipment_id_v0.json"), headers: {})
338+
end
339+
335340
def stub_get_item_eligibility_preview
336341
stub_request(:get, "https://#{hostname}/fba/inbound/v1/eligibility/itemPreview?asin=#{asin}&program=#{program}")
337342
.to_return(status: 200, body: {"payload"=>{"asin"=>asin, "program"=>program, "isEligibleForProgram"=>true}}.to_json, headers: {})

0 commit comments

Comments
 (0)