Commit 60ab1d74 authored by Paul Slaughter's avatar Paul Slaughter

Merge branch 'mg-fix-broken-master-jest' into 'master'

Fix broken master - bad axios mock in jest

Closes #12909

See merge request gitlab-org/gitlab-ee!14734
parents 8b243add 5da5e072
...@@ -3,8 +3,6 @@ import axios from '~/lib/utils/axios_utils'; ...@@ -3,8 +3,6 @@ import axios from '~/lib/utils/axios_utils';
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
import CustomMetricsFormFields from 'ee/custom_metrics/components/custom_metrics_form_fields.vue'; import CustomMetricsFormFields from 'ee/custom_metrics/components/custom_metrics_form_fields.vue';
jest.mock('~/lib/utils/axios_utils');
describe('custom metrics form fields component', () => { describe('custom metrics form fields component', () => {
let component; let component;
const getNamedInput = name => component.element.querySelector(`input[name="${name}"]`); const getNamedInput = name => component.element.querySelector(`input[name="${name}"]`);
...@@ -40,11 +38,11 @@ describe('custom metrics form fields component', () => { ...@@ -40,11 +38,11 @@ describe('custom metrics form fields component', () => {
}; };
beforeEach(() => { beforeEach(() => {
axios.post.mockRestore(); jest.spyOn(axios, 'post').mockResolvedValue(validQueryResponse);
axios.post.mockResolvedValue(validQueryResponse);
}); });
afterEach(() => { afterEach(() => {
axios.post.mockRestore();
component.destroy(); component.destroy();
}); });
......
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