Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} else {
allPairs.unshift(pair);
}
}
function done() {
if (allPairs.length !== 0) {
throw new Error('Not all staged XHRs were executed');
}
}
if (pairs) {
setNextPair(pairs);
}
fetch.mockImplementation(function (url, args) {
var pair = allPairs.shift();
if (!pair) {
throw new Error('We are making a request that we have not anticipated.');
}
if (pair.request.withCredentials !== false) {
// Make sure every request is attaching cookies
expect(args.credentials).toEqual('include');
}
if (pair.request) {
expect(pair.request.uri).toEqual(url);
if (pair.request.headers) {
expect(pair.request.headers).toEqual(args.headers);
}
} else {
allPairs.unshift(pair);
}
}
function done() {
if (allPairs.length !== 0) {
throw new Error('Not all staged XHRs were executed');
}
}
if (pairs) {
setNextPair(pairs);
}
fetch.mockImplementation(function (url, args) {
var pair = allPairs.shift();
if (!pair) {
throw new Error('We are making a request that we have not anticipated.');
}
if (pair.request.withCredentials !== false) {
// Make sure every request is attaching cookies
expect(args.credentials).toEqual('include');
}
if (pair.request) {
expect(pair.request.uri).toEqual(url);
if (pair.request.headers) {
expect(pair.request.headers).toEqual(args.headers);
}