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 get feed submission list by nt
Browse files Browse the repository at this point in the history
  • Loading branch information
justinemmanuelmercado authored and moltar committed Jun 28, 2020
1 parent cf2c0f2 commit bf37943
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
3 changes: 1 addition & 2 deletions test/unit/__fixtures__/feeds_get_feed_submission_list.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<GetFeedSubmissionListResponse
xmlns="http://mws.amazonaws.com/doc/2009-01-01/">
<GetFeedSubmissionListResponse xmlns="http://mws.amazonaws.com/doc/2009-01-01/">
<GetFeedSubmissionListResult>
<NextToken>2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=</NextToken>
<HasNext>true</HasNext>
Expand Down
15 changes: 15 additions & 0 deletions test/unit/__fixtures__/feeds_get_feed_submission_list_nt.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<GetFeedSubmissionListByNextTokenResponse xmlns="http://mws.amazonaws.com/doc/2009-01-01/">
<GetFeedSubmissionListByNextTokenResult>
<NextToken>none</NextToken>
<HasNext>false</HasNext>
<FeedSubmissionInfo>
<FeedSubmissionId>2291326430</FeedSubmissionId>
<FeedType>_POST_PRODUCT_DATA_</FeedType>
<SubmittedDate>2009-02-20T02:10:35+00:00</SubmittedDate>
<FeedProcessingStatus>_SUBMITTED_</FeedProcessingStatus>
</FeedSubmissionInfo>
</GetFeedSubmissionListByNextTokenResult>
<ResponseMetadata>
<RequestId>1105b931-6f1c-4480-8e97-f3b467840a9e</RequestId>
</ResponseMetadata>
</GetFeedSubmissionListByNextTokenResponse>
23 changes: 23 additions & 0 deletions test/unit/feeds.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ParsingError } from '../../src'
import { NextToken } from '../../src/parsing'
import { createMockHttpClient, mockMwsFail, parsingError } from '../utils'

describe('feeds', () => {
Expand All @@ -19,4 +20,26 @@ describe('feeds', () => {
)
})
})

describe('getFeedSubmissionListByNextToken', () => {
const nextToken = new NextToken('GetFeedSubmissionList', '123')

it('returns a next token and feed submission info if succesful', async () => {
expect.assertions(1)

const mockGetFeedSubmissionListNT = createMockHttpClient('feeds_get_feed_submission_list_nt')

expect(
await mockGetFeedSubmissionListNT.feeds.getFeedSubmissionListByNextToken(nextToken),
).toMatchSnapshot()
})

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

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

0 comments on commit bf37943

Please sign in to comment.