Skip to content

Commit

Permalink
test: adds snapshot testing
Browse files Browse the repository at this point in the history
  • Loading branch information
moltar committed Mar 9, 2020
1 parent bb237cd commit a0828bb
Show file tree
Hide file tree
Showing 2 changed files with 359 additions and 4 deletions.
348 changes: 348 additions & 0 deletions tests/__snapshots__/marketplaces.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,348 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`marketplace AE should match snapshot 1`] = `
AmazonMarketplace {
"advertising": Object {
"bids": Object {
"sponsoredBrands": Object {
"max": 18400,
"min": 24,
},
"sponsoredProducts": Object {
"max": 18400,
"min": 24,
},
},
"countryCode": "AE",
"region": "EU",
"timeZone": "Asia/Dubai",
"uri": "https://advertising-api-eu.amazon.com",
},
"countryCode": "AE",
"currency": "AED",
"id": "A2VIGQ35RCS4UG",
"name": "United Arab Emirates",
"uri": "https://www.amazon.ae",
"webServiceUri": "https://mws.amazonservices.ae",
}
`;

exports[`marketplace AU should match snapshot 1`] = `
AmazonMarketplace {
"advertising": Object {
"bids": Object {
"sponsoredBrands": Object {
"max": 7000,
"min": 10,
},
"sponsoredProducts": Object {
"max": 141000,
"min": 10,
},
},
"countryCode": "AU",
"region": "FE",
"timeZone": "Australia/Sydney",
"uri": "https://advertising-api-fe.amazon.com",
},
"countryCode": "AU",
"currency": "AUD",
"id": "A39IBJ37TRP1C6",
"name": "Australia",
"uri": "https://www.amazon.com.au",
"webServiceUri": "https://mws.amazonservices.com.au",
}
`;

exports[`marketplace BR should match snapshot 1`] = `
AmazonMarketplace {
"countryCode": "BR",
"currency": "BRL",
"id": "A2Q3Y263D00KWC",
"name": "Brazil",
"uri": "https://www.amazon.com.br",
"webServiceUri": "https://mws.amazonservices.com",
}
`;

exports[`marketplace CA should match snapshot 1`] = `
AmazonMarketplace {
"advertising": Object {
"bids": Object {
"sponsoredBrands": Object {
"max": 4900,
"min": 10,
},
"sponsoredProducts": Object {
"max": 100000,
"min": 2,
},
},
"countryCode": "CA",
"region": "NA",
"timeZone": "America/Los_Angeles",
"uri": "https://advertising-api.amazon.com",
},
"countryCode": "CA",
"currency": "CAD",
"id": "A2EUQ1WTGCTBG2",
"name": "Canada",
"uri": "https://www.amazon.ca",
"webServiceUri": "https://mws.amazonservices.ca",
}
`;

exports[`marketplace CN should match snapshot 1`] = `
AmazonMarketplace {
"countryCode": "CN",
"currency": "CNY",
"id": "AAHKV2X7AFYLW",
"name": "China",
"uri": "https://www.amazon.cn",
"webServiceUri": "https://mws.amazonservices.com.cn",
}
`;

exports[`marketplace DE should match snapshot 1`] = `
AmazonMarketplace {
"advertising": Object {
"bids": Object {
"sponsoredBrands": Object {
"max": 3900,
"min": 10,
},
"sponsoredProducts": Object {
"max": 100000,
"min": 2,
},
},
"countryCode": "DE",
"region": "EU",
"timeZone": "Europe/Paris",
"uri": "https://advertising-api-eu.amazon.com",
},
"countryCode": "DE",
"currency": "EUR",
"id": "A1PA6795UKMFR9",
"name": "Germany",
"uri": "https://www.amazon.de",
"webServiceUri": "https://mws-eu.amazonservices.com",
}
`;

exports[`marketplace ES should match snapshot 1`] = `
AmazonMarketplace {
"advertising": Object {
"bids": Object {
"sponsoredBrands": Object {
"max": 3900,
"min": 10,
},
"sponsoredProducts": Object {
"max": 100000,
"min": 2,
},
},
"countryCode": "ES",
"region": "EU",
"timeZone": "Europe/Paris",
"uri": "https://advertising-api-eu.amazon.com",
},
"countryCode": "ES",
"currency": "EUR",
"id": "A1RKKUPIHCS9HS",
"name": "Spain",
"uri": "https://www.amazon.es",
"webServiceUri": "https://mws-eu.amazonservices.com",
}
`;

exports[`marketplace FR should match snapshot 1`] = `
AmazonMarketplace {
"advertising": Object {
"bids": Object {
"sponsoredBrands": Object {
"max": 3900,
"min": 10,
},
"sponsoredProducts": Object {
"max": 100000,
"min": 2,
},
},
"countryCode": "FR",
"region": "EU",
"timeZone": "Europe/Paris",
"uri": "https://advertising-api-eu.amazon.com",
},
"countryCode": "FR",
"currency": "EUR",
"id": "A13V1IB3VIYZZH",
"name": "France",
"uri": "https://www.amazon.fr",
"webServiceUri": "https://mws-eu.amazonservices.com",
}
`;

exports[`marketplace GB should match snapshot 1`] = `
AmazonMarketplace {
"advertising": Object {
"bids": Object {
"sponsoredBrands": Object {
"max": 3100,
"min": 10,
},
"sponsoredProducts": Object {
"max": 100000,
"min": 2,
},
},
"countryCode": "UK",
"region": "EU",
"timeZone": "Europe/London",
"uri": "https://advertising-api-eu.amazon.com",
},
"countryCode": "GB",
"currency": "GBP",
"id": "A1F83G8C2ARO7P",
"name": "United Kingdom",
"uri": "https://www.amazon.co.uk",
"webServiceUri": "https://mws-eu.amazonservices.com",
}
`;

exports[`marketplace IN should match snapshot 1`] = `
AmazonMarketplace {
"countryCode": "IN",
"currency": "INR",
"id": "A21TJRUUN4KGV",
"name": "India",
"uri": "https://www.amazon.in",
"webServiceUri": "https://mws.amazonservices.in",
}
`;

exports[`marketplace IT should match snapshot 1`] = `
AmazonMarketplace {
"advertising": Object {
"bids": Object {
"sponsoredBrands": Object {
"max": 3900,
"min": 10,
},
"sponsoredProducts": Object {
"max": 100000,
"min": 2,
},
},
"countryCode": "DE",
"region": "EU",
"timeZone": "Europe/Paris",
"uri": "https://advertising-api-eu.amazon.com",
},
"countryCode": "IT",
"currency": "EUR",
"id": "APJ6JRA9NG5V4",
"name": "Italy",
"uri": "https://www.amazon.it",
"webServiceUri": "https://mws-eu.amazonservices.com",
}
`;

exports[`marketplace JP should match snapshot 1`] = `
AmazonMarketplace {
"advertising": Object {
"bids": Object {
"sponsoredBrands": Object {
"max": 776000,
"min": 1000,
},
"sponsoredProducts": Object {
"max": 10000000,
"min": 200,
},
},
"countryCode": "JP",
"region": "FE",
"timeZone": "Asia/Tokyo",
"uri": "https://advertising-api-fe.amazon.com",
},
"countryCode": "JP",
"currency": "JPY",
"id": "A1VC38T7YXB528",
"name": "Japan",
"uri": "https://www.amazon.co.jp",
"webServiceUri": "https://mws.amazonservices.jp",
}
`;

exports[`marketplace MX should match snapshot 1`] = `
AmazonMarketplace {
"countryCode": "MX",
"currency": "MXN",
"id": "A1AM78C64UM0Y8",
"name": "Mexico",
"uri": "https://www.amazon.com.mx",
"webServiceUri": "https://mws.amazonservices.com.mx",
}
`;

exports[`marketplace NL should match snapshot 1`] = `
AmazonMarketplace {
"countryCode": "NL",
"currency": "EUR",
"id": "A1805IZSGTT6HS",
"name": "Netherlands",
"uri": "https://www.amazon.nl",
"webServiceUri": "https://mws-eu.amazonservices.com",
}
`;

exports[`marketplace SG should match snapshot 1`] = `
AmazonMarketplace {
"countryCode": "SG",
"currency": "SGD",
"id": "A19VAU5U5O7RUS",
"name": "Singapore",
"uri": "https://www.amazon.sg",
"webServiceUri": "https://mws-fe.amazonservices.com",
}
`;

exports[`marketplace TR should match snapshot 1`] = `
AmazonMarketplace {
"countryCode": "TR",
"currency": "TRY",
"id": "A33AVAJ2PDY3EV",
"name": "Turkey",
"uri": "https://www.amazon.com.tr",
"webServiceUri": "https://mws-eu.amazonservices.com",
}
`;

exports[`marketplace US should match snapshot 1`] = `
AmazonMarketplace {
"advertising": Object {
"bids": Object {
"sponsoredBrands": Object {
"max": 4900,
"min": 10,
},
"sponsoredProducts": Object {
"max": 100000,
"min": 2,
},
},
"countryCode": "US",
"region": "NA",
"timeZone": "America/Los_Angeles",
"uri": "https://advertising-api.amazon.com",
},
"countryCode": "US",
"currency": "USD",
"id": "ATVPDKIKX0DER",
"name": "United States",
"uri": "https://www.amazon.com",
"webServiceUri": "https://mws.amazonservices.com",
}
`;
15 changes: 11 additions & 4 deletions tests/marketplaces.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,20 @@ describe('marketplace', () => {
expect(countryCodes.length).toBe(17)
})

it('files should match the exports', () => {
expect.assertions(countryCodes.length)
describe.each(countryCodes)('%s', countryCode => {
const code = (countryCode as unknown) as keyof typeof amazonMarketplaces

it('should match the exports', () => {
expect.assertions(1)

countryCodes.forEach(countryCode => {
const code = (countryCode as unknown) as keyof typeof amazonMarketplaces
expect(amazonMarketplaces[code].countryCode).toBe(code)
})

it('should match snapshot', () => {
expect.assertions(1)

expect(amazonMarketplaces[code]).toMatchSnapshot()
})
})

it('object is read only', () => {
Expand Down

0 comments on commit a0828bb

Please sign in to comment.