blob: a3783b91f95f4e77e91af97f6689a2e130ff912a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
const axios = jest.requireActual('~/lib/utils/axios_utils').default;
axios.isMock = true;
// Fail tests for unmocked requests
axios.defaults.adapter = config => {
const message =
`Unexpected unmocked request: ${JSON.stringify(config, null, 2)}\n` +
'Consider using the `axios-mock-adapter` module in tests.';
const error = new Error(message);
error.config = config;
global.fail(error);
throw error;
};
export default axios;
|