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

Commit

Permalink
test: get report schedule list
Browse files Browse the repository at this point in the history
  • Loading branch information
justinemmanuelmercado committed Jun 11, 2020
1 parent 7faa1ac commit 0b30891
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
14 changes: 14 additions & 0 deletions test/unit/__fixtures__/reports_get_report_schedule_list.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<GetReportScheduleListResponse xmlns="http://mws.amazonservices.com/doc/2009-01-01/">
<GetReportScheduleListResult>
<NextToken></NextToken>
<HasNext>false</HasNext>
<ReportSchedule>
<ReportType>_GET_ORDERS_DATA_</ReportType>
<Schedule>_30_DAYS_</Schedule>
<ScheduledDate>2009-02-20T02:10:42+00:00</ScheduledDate>
</ReportSchedule>
</GetReportScheduleListResult>
<ResponseMetadata>
<RequestId>c0464157-b74f-4e52-bd1a-4ebf4bc7e5aa</RequestId>
</ResponseMetadata>
</GetReportScheduleListResponse>
28 changes: 26 additions & 2 deletions test/unit/reports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,28 @@ const mockMwsFail = new MWS(
)

describe('reports', () => {
describe('getReportScheduleList', () => {
const parameters = {}

it('returns detailed information about a report schedule if succesful', async () => {
expect.assertions(1)

const mockGetReportScheduleList = createMockHttpClient('reports_get_report_schedule_list')

expect(
await mockGetReportScheduleList.reports.getReportScheduleList(parameters),
).toMatchSnapshot()
})

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

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

describe('manageReportSchedule', () => {
const parameters = {
ReportType: '_GET_ORDERS_DATA_',
Expand All @@ -46,9 +68,11 @@ describe('reports', () => {
it('returns count and report schedule if succesful', async () => {
expect.assertions(1)

const mockGetReportCount = createMockHttpClient('reports_manage_report_schedule')
const mockManageReportSchedule = createMockHttpClient('reports_manage_report_schedule')

expect(await mockGetReportCount.reports.manageReportSchedule(parameters)).toMatchSnapshot()
expect(
await mockManageReportSchedule.reports.manageReportSchedule(parameters),
).toMatchSnapshot()
})

it('throws a parsing error when the response is nt valid', async () => {
Expand Down

0 comments on commit 0b30891

Please sign in to comment.