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

Commit

Permalink
fix: update codecs to match c# library. add comments to fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
justinemmanuelmercado committed Jun 15, 2020
1 parent f0af8e6 commit 4a03e1f
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/sections/reports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,16 @@ interface GetReportListParameters {

const ReportInfo = Codec.interface({
ReportId: ensureString,
ReportType: optional(ReportType),
ReportType,
ReportRequestId: optional(ensureString),
AvailableDate: optional(mwsDate),
Acknowledged: optional(boolean),
AcknowledgedDate: optional(mwsDate),
})

const GetReportListResult = Codec.interface({
HasNext: boolean,
NextToken: optional(nextTokenCodec('GetReportList')),
HasNext: optional(boolean),
ReportInfo: optional(oneOf([array(ReportInfo), ReportInfo, exactly('')])),
})

Expand Down Expand Up @@ -256,9 +256,9 @@ interface ManageReportScheduleParameters {
}

const ReportSchedule = Codec.interface({
ReportType: optional(ReportType),
Schedule: optional(ScheduleCodec),
ScheduleDate: optional(mwsDate),
ReportType,
Schedule: ScheduleCodec,
ScheduleDate: mwsDate,
})

const ManageReportSchedule = Codec.interface({
Expand All @@ -280,7 +280,7 @@ interface GetReportScheduleListParameters {

const GetReportScheduleList = Codec.interface({
NextToken: optional(nextTokenCodec('GetReportScheduleList')),
HasNext: optional(boolean),
HasNext: boolean,
ReportSchedule: optional(oneOf([array(ReportSchedule), ReportSchedule, exactly('')])),
})

Expand Down
2 changes: 1 addition & 1 deletion test/integration/reports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ describe('reports', () => {
expect(response).toBeDefined()
})

itci('should be able to request a report', async () => {
itci('should be able to get a report', async () => {
expect.assertions(2)

const [response] = await reports.getReport({ ReportId: '20812705939018404' })
Expand Down
1 change: 1 addition & 0 deletions test/unit/__fixtures__/reports_cancel_report_requests.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<CancelReportRequestsResponse xmlns="http://mws.amazonservices.com/doc/2009-01-01/">
<CancelReportRequestsResult>
<Count>1</Count>
<!--1 or more repetitions:-->
<ReportRequestInfo>
<ReportRequestId>2291326454</ReportRequestId>
<ReportType>_GET_MERCHANT_LISTINGS_DATA_</ReportType>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<CancelReportRequestsResponse xmlns="http://mws.amazonaws.com/doc/2009-01-01/">
<CancelReportRequestsResult>
<Count>2</Count>
<!--1 or more repetitions:-->
<ReportRequestInfo>
<ReportType>_GET_MERCHANT_LISTINGS_ALL_DATA_</ReportType>
<ReportProcessingStatus>_DONE_</ReportProcessingStatus>
Expand Down
2 changes: 2 additions & 0 deletions test/unit/__fixtures__/reports_get_report_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
<GetReportListResult>
<NextToken>2YgYW55IPQhvu5hbCBwbGVhc3VyZS4=</NextToken>
<HasNext>true</HasNext>
<!--1 or more repetitions:-->
<ReportInfo>
<ReportId>898899473</ReportId>
<ReportType>_GET_MERCHANT_LISTINGS_DATA_</ReportType>
<!--Optional:-->
<ReportRequestId>2278662938</ReportRequestId>
<AvailableDate>2009-02-10T09:22:33+00:00</AvailableDate>
<Acknowledged>false</Acknowledged>
Expand Down
1 change: 1 addition & 0 deletions test/unit/__fixtures__/reports_get_report_request_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<GetReportRequestListResult>
<NextToken>2YgYW55IPQhcm5hbCBwbGVhc3VyZS4=</NextToken>
<HasNext>true</HasNext>
<!--1 or more repetitions:-->
<ReportRequestInfo>
<ReportRequestId>2291326454</ReportRequestId>
<ReportType>_GET_MERCHANT_LISTINGS_DATA_</ReportType>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<GetReportRequestListResponse xmlns="http://mws.amazonaws.com/doc/2009-01-01/">
<GetReportRequestListResult>
<HasNext>false</HasNext>
<!--1 or more repetitions:-->
<ReportRequestInfo>
<ReportType>_GET_MERCHANT_LISTINGS_DATA_</ReportType>
<ReportProcessingStatus>_DONE_</ReportProcessingStatus>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<GetReportScheduleListResult>
<NextToken></NextToken>
<HasNext>false</HasNext>
<!--1 or more repetitions:-->
<ReportSchedule>
<ReportType>_GET_ORDERS_DATA_</ReportType>
<Schedule>_30_DAYS_</Schedule>
Expand Down
1 change: 1 addition & 0 deletions test/unit/__fixtures__/reports_manage_report_schedule.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<ManageReportScheduleResponse xmlns="http://mws.amazonservices.com/doc/2009-01-01/">
<ManageReportScheduleResult>
<Count>1</Count>
<!--1 or more repetitions:-->
<ReportSchedule>
<ReportType>_GET_ORDERS_DATA_</ReportType>
<Schedule>_30_DAYS_</Schedule>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<UpdateReportAcknowledgementsResponse xmlns="http://mws.amazonservices.com/doc/2009-01-01/">
<UpdateReportAcknowledgementsResult>
<Count>1</Count>
<!--1 or more repetitions:-->
<ReportInfo>
<ReportId>841997483</ReportId>
<ReportType>_GET_MERCHANT_LISTINGS_DATA_</ReportType>
<!--Optional:-->
<ReportRequestId>2234038326</ReportRequestId>
<AvailableDate>2009-01-06T03:48:36+00:00</AvailableDate>
<Acknowledged>true</Acknowledged>
Expand Down

0 comments on commit 4a03e1f

Please sign in to comment.