import {getJsonFeed, expectJsonResponse} from './utils/integration-test-utils'; import includes from 'lodash/includes'; import etfUsPpss from './../data/etf-us/etf.ppss'; import etfGbPpss from './../data/etf-gb/etf.ppss'; import etfDePpss from './../data/etf-de/etf.ppss'; import enGbPpss from './../data/en-gb/gw.ppss'; import deDePpss from './../data/de-de/gw.ppss'; import itItPpss from './../data/it-it/gw.ppss'; let doFullScrape = false; [ { localeId: 'etf-us', localePath: 'etf-us/investor', ppssFeed: etfUsPpss }, { localeId: 'etf-gb', localePath: 'etf-gb/investor', ppssFeed: etfGbPpss }, { localeId: 'etf-de', localePath: 'etf-de/privatanleger', ppssFeed: etfDePpss } ].forEach((suiteData) => { if (doFullScrape) { describe(`scrape all qa ${suiteData.localeId} feeds`, () => { let fundIds = suiteData.ppssFeed.globalProductsValue.fundExplrVal.map((item) => {return item.fundId;}); fundIds.forEach((fundId) => { let testFeeds = [ `http://rcovlnx0192:8322/${suiteData.localePath}/data/etf/${fundId}/etf.distribution-history`, `http://rcovlnx0192:8322/${suiteData.localePath}/data/etf/${fundId}/etf.fund-details`, `http://rcovlnx0192:8322/${suiteData.localePath}/data/etf/${fundId}/etf.overview`, `http://rcovlnx0192:8322/${suiteData.localePath}/data/etf/${fundId}/etf.performance`, `http://rcovlnx0192:8322/${suiteData.localePath}/data/etf/${fundId}/etf.performance-history`, `http://rcovlnx0192:8322/${suiteData.localePath}/data/etf/${fundId}/etf.portfolio`, `http://rcovlnx0192:8322/${suiteData.localePath}/data/etf/${fundId}/etf.price`, `http://rcovlnx0192:8322/${suiteData.localePath}/data/etf/${fundId}/etf.price-history` ]; testFeeds.forEach((testFeed) => { it(testFeed + ' should return valid JSON', (done) => { // eslint-disable-next-line console.log(testFeed); getJsonFeed(testFeed) .then(response => { expectJsonResponse(response, done); }) .then(done) .catch((e) => { expect(e).toBeNull(); done(); }); }); }); }); }); } else { xdescribe(`scrape all qa ${suiteData.localeId} feeds`); } }); [ { localeId: 'en-gb', localePath: 'en-gb/investor', ppssFeed: enGbPpss }, { localeId: 'de-de', localePath: 'de-de/privatanleger', ppssFeed: deDePpss }, { localeId: 'it-it', localePath: 'it-it/investor', ppssFeed: itItPpss } ].forEach((suiteData) => { if (doFullScrape) { describe(`scrape all qa ${suiteData.localeId} feeds`, () => { let fundIds = suiteData.ppssFeed.globalProductsValue.ppsListIntl.map((item) => {return item.fundInfo.fundNumber.val;}); // WORKAROUND: multiple same fund ids let lastFundId = []; fundIds.forEach((fundId) => { if (includes(lastFundId, fundId)) { return; } lastFundId.push(fundId); let testFeeds = [ `http://rcovlnx0192:8322/${suiteData.localePath}/data/gw/${fundId}/gw.fund-details`, `http://rcovlnx0192:8322/${suiteData.localePath}/data/gw/${fundId}/gw.overview`, `http://rcovlnx0192:8322/${suiteData.localePath}/data/gw/${fundId}/gw.price-distribution`, `http://rcovlnx0192:8322/${suiteData.localePath}/data/gw/${fundId}/gw.portfolio`, `http://rcovlnx0192:8322/${suiteData.localePath}/data/gw/${fundId}/gw.performance`, `http://rcovlnx0192:8322/${suiteData.localePath}/data/gw/${fundId}/gw.performance-history` ]; it(`http://rcovlnx0192:8322/${suiteData.localePath}/data/gw/${fundId}/gw.nav-history needs to be implemented`); testFeeds.forEach((testFeed) => { it(testFeed + ' should return valid JSON', (done) => { // eslint-disable-next-line console.log(testFeed); getJsonFeed(testFeed) .then(response => { expectJsonResponse(response, done); }) .then(done) .catch((e) => { expect(e).toBeNull(); done(); }); }); }); }); }); } else { xdescribe(`scrape all qa ${suiteData.localeId} feeds`); } });