Migrate related items tree specs to Jest

parent dd78e9b5
......@@ -8,7 +8,10 @@ import * as epicUtils from 'ee/related_items_tree/utils/epic_utils';
import { issuableTypesMap } from 'ee/related_issues/constants';
import EpicActionsSplitButton from 'ee/related_items_tree/components/epic_actions_split_button.vue';
import { mockParentItem, mockQueryResponse } from '../mock_data';
import {
mockParentItem,
mockQueryResponse,
} from '../../../javascripts/related_items_tree/mock_data';
const createComponent = ({ slots } = {}) => {
const store = createDefaultStore();
......
......@@ -14,7 +14,12 @@ import createDefaultStore from 'ee/related_items_tree/store';
import * as epicUtils from 'ee/related_items_tree/utils/epic_utils';
import { ChildType, ChildState } from 'ee/related_items_tree/constants';
import { mockParentItem, mockInitialConfig, mockQueryResponse, mockIssue1 } from '../mock_data';
import {
mockParentItem,
mockInitialConfig,
mockQueryResponse,
mockIssue1,
} from '../../../javascripts/related_items_tree/mock_data';
const mockItem = Object.assign({}, mockIssue1, {
type: ChildType.Issue,
......@@ -272,7 +277,7 @@ describe('RelatedItemsTree', () => {
describe('methods', () => {
describe('handleRemoveClick', () => {
it('calls `setRemoveItemModalProps` action with params `parentItem` and `item`', () => {
spyOn(wrapper.vm, 'setRemoveItemModalProps');
jest.spyOn(wrapper.vm, 'setRemoveItemModalProps');
wrapper.vm.handleRemoveClick();
......
......@@ -11,7 +11,11 @@ import createDefaultStore from 'ee/related_items_tree/store';
import * as epicUtils from 'ee/related_items_tree/utils/epic_utils';
import { ChildType } from 'ee/related_items_tree/constants';
import { mockParentItem, mockQueryResponse, mockEpic1 } from '../mock_data';
import {
mockParentItem,
mockQueryResponse,
mockEpic1,
} from '../../../javascripts/related_items_tree/mock_data';
const mockItem = Object.assign({}, mockEpic1, {
type: ChildType.Epic,
......@@ -114,7 +118,7 @@ describe('RelatedItemsTree', () => {
describe('methods', () => {
describe('handleChevronClick', () => {
it('calls `toggleItem` action with `item` as a param', () => {
spyOn(wrapper.vm, 'toggleItem');
jest.spyOn(wrapper.vm, 'toggleItem');
wrapper.vm.handleChevronClick();
......
......@@ -41,6 +41,12 @@ class CustomEnvironment extends JSDOMEnvironment {
this.global.fixturesBasePath = `${ROOT_PATH}/tmp/tests/frontend/fixtures${IS_EE ? '-ee' : ''}`;
this.global.staticFixturesBasePath = `${ROOT_PATH}/spec/frontend/fixtures`;
/**
* window.fetch() is required by the apollo-upload-client library otherwise
* a ReferenceError is generated: https://github.com/jaydenseric/apollo-upload-client/issues/100
*/
this.global.fetch = () => {};
// Not yet supported by JSDOM: https://github.com/jsdom/jsdom/issues/317
this.global.document.createRange = () => ({
setStart: () => {},
......
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