Merge branch '61797-error-tracking-jest' into 'master'
Move error_tracking_frontend specs to Jest Closes #61797 See merge request gitlab-org/gitlab-ce!30211
This commit is contained in:
commit
406b67ca82
8 changed files with 10 additions and 7 deletions
|
@ -4,7 +4,7 @@ import ErrorTrackingSettings from '~/error_tracking_settings/components/app.vue'
|
||||||
import ErrorTrackingForm from '~/error_tracking_settings/components/error_tracking_form.vue';
|
import ErrorTrackingForm from '~/error_tracking_settings/components/error_tracking_form.vue';
|
||||||
import ProjectDropdown from '~/error_tracking_settings/components/project_dropdown.vue';
|
import ProjectDropdown from '~/error_tracking_settings/components/project_dropdown.vue';
|
||||||
import createStore from '~/error_tracking_settings/store';
|
import createStore from '~/error_tracking_settings/store';
|
||||||
import { TEST_HOST } from 'spec/test_constants';
|
import { TEST_HOST } from 'helpers/test_constants';
|
||||||
|
|
||||||
const localVue = createLocalVue();
|
const localVue = createLocalVue();
|
||||||
localVue.use(Vuex);
|
localVue.use(Vuex);
|
|
@ -1,5 +1,5 @@
|
||||||
import createStore from '~/error_tracking_settings/store';
|
import createStore from '~/error_tracking_settings/store';
|
||||||
import { TEST_HOST } from 'spec/test_constants';
|
import { TEST_HOST } from '../helpers/test_constants';
|
||||||
|
|
||||||
const defaultStore = createStore();
|
const defaultStore = createStore();
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
import MockAdapter from 'axios-mock-adapter';
|
import MockAdapter from 'axios-mock-adapter';
|
||||||
import testAction from 'spec/helpers/vuex_action_helper';
|
import testAction from 'helpers/vuex_action_helper';
|
||||||
import { TEST_HOST } from 'spec/test_constants';
|
import { TEST_HOST } from 'helpers/test_constants';
|
||||||
import axios from '~/lib/utils/axios_utils';
|
import axios from '~/lib/utils/axios_utils';
|
||||||
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
|
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
|
||||||
import actionsDefaultExport, * as actions from '~/error_tracking_settings/store/actions';
|
import { refreshCurrentPage } from '~/lib/utils/url_utility';
|
||||||
|
import * as actions from '~/error_tracking_settings/store/actions';
|
||||||
import * as types from '~/error_tracking_settings/store/mutation_types';
|
import * as types from '~/error_tracking_settings/store/mutation_types';
|
||||||
import defaultState from '~/error_tracking_settings/store/state';
|
import defaultState from '~/error_tracking_settings/store/state';
|
||||||
import { projectList } from '../mock';
|
import { projectList } from '../mock';
|
||||||
|
|
||||||
|
jest.mock('~/lib/utils/url_utility');
|
||||||
|
|
||||||
describe('error tracking settings actions', () => {
|
describe('error tracking settings actions', () => {
|
||||||
let state;
|
let state;
|
||||||
|
|
||||||
|
@ -21,6 +24,7 @@ describe('error tracking settings actions', () => {
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
mock.restore();
|
mock.restore();
|
||||||
|
refreshCurrentPage.mockClear();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should request and transform the project list', done => {
|
it('should request and transform the project list', done => {
|
||||||
|
@ -111,7 +115,6 @@ describe('error tracking settings actions', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should save the page', done => {
|
it('should save the page', done => {
|
||||||
const refreshCurrentPage = spyOnDependency(actionsDefaultExport, 'refreshCurrentPage');
|
|
||||||
mock.onPatch(TEST_HOST).reply(200);
|
mock.onPatch(TEST_HOST).reply(200);
|
||||||
testAction(actions.updateSettings, null, state, [], [{ type: 'requestSettings' }], () => {
|
testAction(actions.updateSettings, null, state, [], [{ type: 'requestSettings' }], () => {
|
||||||
expect(mock.history.patch.length).toBe(1);
|
expect(mock.history.patch.length).toBe(1);
|
|
@ -1,4 +1,4 @@
|
||||||
import { TEST_HOST } from 'spec/test_constants';
|
import { TEST_HOST } from 'helpers/test_constants';
|
||||||
import mutations from '~/error_tracking_settings/store/mutations';
|
import mutations from '~/error_tracking_settings/store/mutations';
|
||||||
import defaultState from '~/error_tracking_settings/store/state';
|
import defaultState from '~/error_tracking_settings/store/state';
|
||||||
import * as types from '~/error_tracking_settings/store/mutation_types';
|
import * as types from '~/error_tracking_settings/store/mutation_types';
|
Loading…
Reference in a new issue