Commit 4b24b7d3 authored by Mike Greiling's avatar Mike Greiling

Merge branch 'migrate-related-items-tree-specs' into 'master'

Migrate related items tree specs to Jest & VTU

See merge request gitlab-org/gitlab!19268
parents cbd3e638 cde9d182
......@@ -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();
......
......@@ -15,7 +15,12 @@ import * as epicUtils from 'ee/related_items_tree/utils/epic_utils';
import { ChildType, ChildState } from 'ee/related_items_tree/constants';
import { PathIdSeparator } from 'ee/related_issues/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,
......@@ -273,7 +278,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();
......
......@@ -12,7 +12,11 @@ import * as epicUtils from 'ee/related_items_tree/utils/epic_utils';
import { ChildType } from 'ee/related_items_tree/constants';
import { PathIdSeparator } from 'ee/related_issues/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,
......@@ -115,7 +119,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