From a0828bbcc995056166e69deb67ee40c9fd91ec55 Mon Sep 17 00:00:00 2001 From: Roman Filippov Date: Mon, 9 Mar 2020 22:56:38 +0700 Subject: [PATCH] test: adds snapshot testing --- tests/__snapshots__/marketplaces.test.ts.snap | 348 ++++++++++++++++++ tests/marketplaces.test.ts | 15 +- 2 files changed, 359 insertions(+), 4 deletions(-) create mode 100644 tests/__snapshots__/marketplaces.test.ts.snap diff --git a/tests/__snapshots__/marketplaces.test.ts.snap b/tests/__snapshots__/marketplaces.test.ts.snap new file mode 100644 index 00000000..8b3c6971 --- /dev/null +++ b/tests/__snapshots__/marketplaces.test.ts.snap @@ -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", +} +`; diff --git a/tests/marketplaces.test.ts b/tests/marketplaces.test.ts index fce52ce0..3aa3769c 100644 --- a/tests/marketplaces.test.ts +++ b/tests/marketplaces.test.ts @@ -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', () => {