Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import SERVICE_DEFAULTS from 'terra-toolkit/config/wdio/services.default-config';
import loadSiteConfig from '../../../scripts/generate-app-config/loadSiteConfig';
import generatePagesConfig from '../../../scripts/generate-app-config/generatePagesConfig';
const VIEWPORT_KEYS = process.env.FORM_FACTOR ? [process.env.FORM_FACTOR] : Object.keys(SERVICE_DEFAULTS.terraViewports);
const baseRouteOfExample = (siteConfig, pageKey) => {
const baseRouteLink = siteConfig.navConfig.navigation.links.find(link => link.pageTypes.includes(pageKey));
return baseRouteLink ? baseRouteLink.path : null;
};
const mergeObjectOfArrays = (object1, object2) => {
const mergedObject = {};
VIEWPORT_KEYS.forEach((key) => {
mergedObject[key] = (object1[key] || []).concat(object2[key] || []);
});
return mergedObject;
};
const createViewportObjectFromPageTree = (pageKey, currentPage, currentRoute, options = {}) => {
if (!currentPage.pages && options.testSetup.examples[currentPage.name]) {