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

Commit

Permalink
test: made tests for getFeedSubmissionList
Browse files Browse the repository at this point in the history
  • Loading branch information
justinemmanuelmercado authored and moltar committed Jun 28, 2020
1 parent 501283c commit 1c143e8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 5 deletions.
16 changes: 16 additions & 0 deletions test/unit/__fixtures__/feeds_get_feed_submissison_list.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<GetFeedSubmissionListResponse
xmlns="http://mws.amazonaws.com/doc/2009-01-01/">
<GetFeedSubmissionListResult>
<NextToken>2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=</NextToken>
<HasNext>true</HasNext>
<FeedSubmissionInfo>
<FeedSubmissionId>2291326430</FeedSubmissionId>
<FeedType>_POST_PRODUCT_DATA_</FeedType>
<SubmittedDate>2009-02-20T02:10:35+00:00</SubmittedDate>
<FeedProcessingStatus>_SUBMITTED_</FeedProcessingStatus>
</FeedSubmissionInfo>
</GetFeedSubmissionListResult>
<ResponseMetadata>
<RequestId>1105b931-6f1c-4480-8e97-f3b467840a9e</RequestId>
</ResponseMetadata>
</GetFeedSubmissionListResponse>
23 changes: 18 additions & 5 deletions test/unit/feeds.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
// import { ParsingError } from '../../src'
// import { mockMwsFail, mockMwsServiceStatus, parsingError } from '../utils'
import { ParsingError } from '../../src'
import { createMockHttpClient, mockMwsFail, parsingError } from '../utils'

describe('feeds', () => {
it('is true', () => {
expect.hasAssertions()
expect(true).toBe(true)
describe('getFeedSubmissionList', () => {
it('returns a next token and feed submission info if succesful', async () => {
expect.assertions(1)

const mockGetFeedSubmissionList = createMockHttpClient('feeds_get_feed_submission_list')

expect(await mockGetFeedSubmissionList.feeds.getFeedSubmissionList()).toMatchSnapshot()
})

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

await expect(() => mockMwsFail.feeds.getFeedSubmissionList()()).rejects.toStrictEqual(
new ParsingError(parsingError),
)
})
})
})

0 comments on commit 1c143e8

Please sign in to comment.