Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
['countries', 'country'].map(operationName => {
fetch.mock(
(url: string, options: Options) => {
if (url !== GRAPHQL_ENDPOINT || options.method !== 'POST') {
return false;
}
if (typeof options.body === 'string') {
const body = JSON.parse(options.body);
return (
body.operationName === operationName &&
body.variables.locale === locale
);
}
return false;
},
fixtures[operationName][locale],
{overwriteRoutes: false},
);