Commit 84b93dc1 authored by pburdette's avatar pburdette

Remove unused mocks

Remove axios mocks that
are not needed in the tests
since we are using jest spy.
parent 492caa7d
import Api from '~/api'; import Api from '~/api';
import MockAdapter from 'axios-mock-adapter';
import axios from '~/lib/utils/axios_utils';
import { GlFilteredSearchToken, GlFilteredSearchSuggestion, GlLoadingIcon } from '@gitlab/ui'; import { GlFilteredSearchToken, GlFilteredSearchSuggestion, GlLoadingIcon } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import PipelineBranchNameToken from '~/pipelines/components/tokens/pipeline_branch_name_token.vue'; import PipelineBranchNameToken from '~/pipelines/components/tokens/pipeline_branch_name_token.vue';
...@@ -8,7 +6,6 @@ import { branches, mockBranchesAfterMap } from '../mock_data'; ...@@ -8,7 +6,6 @@ import { branches, mockBranchesAfterMap } from '../mock_data';
describe('Pipeline Branch Name Token', () => { describe('Pipeline Branch Name Token', () => {
let wrapper; let wrapper;
let mock;
const findFilteredSearchToken = () => wrapper.find(GlFilteredSearchToken); const findFilteredSearchToken = () => wrapper.find(GlFilteredSearchToken);
const findAllFilteredSearchSuggestions = () => wrapper.findAll(GlFilteredSearchSuggestion); const findAllFilteredSearchSuggestions = () => wrapper.findAll(GlFilteredSearchSuggestion);
...@@ -50,15 +47,12 @@ describe('Pipeline Branch Name Token', () => { ...@@ -50,15 +47,12 @@ describe('Pipeline Branch Name Token', () => {
}; };
beforeEach(() => { beforeEach(() => {
mock = new MockAdapter(axios);
jest.spyOn(Api, 'branches').mockResolvedValue({ data: branches }); jest.spyOn(Api, 'branches').mockResolvedValue({ data: branches });
createComponent(); createComponent();
}); });
afterEach(() => { afterEach(() => {
mock.restore();
wrapper.destroy(); wrapper.destroy();
wrapper = null; wrapper = null;
}); });
......
import Api from '~/api'; import Api from '~/api';
import MockAdapter from 'axios-mock-adapter';
import axios from '~/lib/utils/axios_utils';
import { GlFilteredSearchToken, GlFilteredSearchSuggestion, GlLoadingIcon } from '@gitlab/ui'; import { GlFilteredSearchToken, GlFilteredSearchSuggestion, GlLoadingIcon } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import PipelineTriggerAuthorToken from '~/pipelines/components/tokens/pipeline_trigger_author_token.vue'; import PipelineTriggerAuthorToken from '~/pipelines/components/tokens/pipeline_trigger_author_token.vue';
...@@ -8,7 +6,6 @@ import { users } from '../mock_data'; ...@@ -8,7 +6,6 @@ import { users } from '../mock_data';
describe('Pipeline Trigger Author Token', () => { describe('Pipeline Trigger Author Token', () => {
let wrapper; let wrapper;
let mock;
const findFilteredSearchToken = () => wrapper.find(GlFilteredSearchToken); const findFilteredSearchToken = () => wrapper.find(GlFilteredSearchToken);
const findAllFilteredSearchSuggestions = () => wrapper.findAll(GlFilteredSearchSuggestion); const findAllFilteredSearchSuggestions = () => wrapper.findAll(GlFilteredSearchSuggestion);
...@@ -49,15 +46,12 @@ describe('Pipeline Trigger Author Token', () => { ...@@ -49,15 +46,12 @@ describe('Pipeline Trigger Author Token', () => {
}; };
beforeEach(() => { beforeEach(() => {
mock = new MockAdapter(axios);
jest.spyOn(Api, 'projectUsers').mockResolvedValue(users); jest.spyOn(Api, 'projectUsers').mockResolvedValue(users);
createComponent(); createComponent();
}); });
afterEach(() => { afterEach(() => {
mock.restore();
wrapper.destroy(); wrapper.destroy();
wrapper = null; wrapper = null;
}); });
......
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