UNPKG

testophobia

Version:
30 lines (27 loc) 1.08 kB
import {getActionFileName} from '../file/file-name.js'; /** * Ensure test actions have unique descriptions * * @param {object} config The config file to check * @param {object} test The test file to check for overrides * @param {string} screenType The screen dimension that corresponds to the clip region * @return {object} The clip region definition */ export const validateUniqueActionDescriptions = (actions, output) => { if (actions) { const actionNames = []; actions.forEach((a, i) => { const name = getActionFileName(i, a); if (actionNames.includes(name)) { output.displayFailure('Duplicate action description: ' + getActionFileName(i, a, true)); } actionNames.push(name); }); } }; export const checkBaseUrl = (baseUrl, output) => { const slashes = baseUrl.match(/\//g); const hashes = baseUrl.match(/\#/); if ((slashes && slashes.length > 2) || (hashes && hashes.length)) output.displayFailure('Error: baseUrl should only contain a domain name, but a path was supplied. Handle all pathing in test files.'); };