summaryrefslogtreecommitdiff
path: root/spec/frontend/mocks/ce/lib/utils/axios_utils.js
blob: b4065626b0919c6dabf0ac70aa39be843634095a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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` in tests.';
  const error = new Error(message);
  error.config = config;
  throw error;
};

export default axios;