Commit 13bb3483 authored by Winnie Hellmann's avatar Winnie Hellmann

Fail tests for unmocked axios requests

parent 69f9ec77
import axios from '~/lib/utils/axios_utils';
const testTimeoutInMs = 300;
jest.setTimeout(testTimeoutInMs);
......@@ -14,3 +16,15 @@ afterEach(() => {
throw new Error(`Test took too long (${elapsedTimeInMs}ms > ${testTimeoutInMs}ms)!`);
}
});
// fail tests for unmocked requests
beforeEach(done => {
axios.defaults.adapter = config => {
const error = new Error(`Unexpected unmocked request: ${JSON.stringify(config, null, 2)}`);
error.config = config;
done.fail(error);
return Promise.reject(error);
};
done();
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment