Commit 0bfb273e authored by Albert Salim's avatar Albert Salim Committed by Jose Ivan Vargas

Change getJSONFixture to import on static fixtures

parent 4ce6e16a
...@@ -198,6 +198,7 @@ if (!IS_PRODUCTION) { ...@@ -198,6 +198,7 @@ if (!IS_PRODUCTION) {
Object.assign(alias, { Object.assign(alias, {
test_fixtures: path.join(ROOT_PATH, `tmp/tests/frontend/${fixtureDir}`), test_fixtures: path.join(ROOT_PATH, `tmp/tests/frontend/${fixtureDir}`),
test_fixtures_static: path.join(ROOT_PATH, 'spec/frontend/fixtures/static'),
test_helpers: path.join(ROOT_PATH, 'spec/frontend_integration/test_helpers'), test_helpers: path.join(ROOT_PATH, 'spec/frontend_integration/test_helpers'),
}); });
} }
......
...@@ -11,8 +11,7 @@ import { ...@@ -11,8 +11,7 @@ import {
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount, createLocalVue } from '@vue/test-utils';
import Vuex from 'vuex'; import Vuex from 'vuex';
// eslint-disable-next-line import/no-deprecated import mockProjects from 'test_fixtures_static/projects.json';
import { getJSONFixture } from 'helpers/fixtures';
import CreateIssueForm from 'ee/related_items_tree/components/create_issue_form.vue'; import CreateIssueForm from 'ee/related_items_tree/components/create_issue_form.vue';
import createDefaultStore from 'ee/related_items_tree/store'; import createDefaultStore from 'ee/related_items_tree/store';
import ProjectAvatar from '~/vue_shared/components/project_avatar.vue'; import ProjectAvatar from '~/vue_shared/components/project_avatar.vue';
...@@ -24,9 +23,6 @@ import { ...@@ -24,9 +23,6 @@ import {
mockMixedFrequentlyUsedProjects, mockMixedFrequentlyUsedProjects,
} from '../mock_data'; } from '../mock_data';
// eslint-disable-next-line import/no-deprecated
const mockProjects = getJSONFixture('static/projects.json');
const localVue = createLocalVue(); const localVue = createLocalVue();
localVue.use(Vuex); localVue.use(Vuex);
......
...@@ -3,22 +3,18 @@ import { shallowMount, createLocalVue } from '@vue/test-utils'; ...@@ -3,22 +3,18 @@ import { shallowMount, createLocalVue } from '@vue/test-utils';
import AxiosMockAdapter from 'axios-mock-adapter'; import AxiosMockAdapter from 'axios-mock-adapter';
import Vuex from 'vuex'; import Vuex from 'vuex';
import mockProjects from 'test_fixtures_static/projects.json';
import CreateIssueForm from 'ee/related_items_tree/components/create_issue_form.vue'; import CreateIssueForm from 'ee/related_items_tree/components/create_issue_form.vue';
import AddIssuableForm from '~/related_issues/components/add_issuable_form.vue'; import AddIssuableForm from '~/related_issues/components/add_issuable_form.vue';
import SlotSwitch from '~/vue_shared/components/slot_switch.vue'; import SlotSwitch from '~/vue_shared/components/slot_switch.vue';
import RelatedItemsTreeApp from 'ee/related_items_tree/components/related_items_tree_app.vue'; import RelatedItemsTreeApp from 'ee/related_items_tree/components/related_items_tree_app.vue';
import RelatedItemsTreeHeader from 'ee/related_items_tree/components/related_items_tree_header.vue'; import RelatedItemsTreeHeader from 'ee/related_items_tree/components/related_items_tree_header.vue';
import createDefaultStore from 'ee/related_items_tree/store'; import createDefaultStore from 'ee/related_items_tree/store';
// eslint-disable-next-line import/no-deprecated
import { getJSONFixture } from 'helpers/fixtures';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { issuableTypesMap } from '~/related_issues/constants'; import { issuableTypesMap } from '~/related_issues/constants';
import { mockInitialConfig, mockParentItem, mockEpics, mockIssues } from '../mock_data'; import { mockInitialConfig, mockParentItem, mockEpics, mockIssues } from '../mock_data';
// eslint-disable-next-line import/no-deprecated
const mockProjects = getJSONFixture('static/projects.json');
const localVue = createLocalVue(); const localVue = createLocalVue();
localVue.use(Vuex); localVue.use(Vuex);
......
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import mockProjects from 'test_fixtures_static/projects.json';
// eslint-disable-next-line import/no-deprecated
import { getJSONFixture } from 'helpers/fixtures';
import { ChildType, ChildState } from 'ee/related_items_tree/constants'; import { ChildType, ChildState } from 'ee/related_items_tree/constants';
import * as actions from 'ee/related_items_tree/store/actions'; import * as actions from 'ee/related_items_tree/store/actions';
import * as types from 'ee/related_items_tree/store/mutation_types'; import * as types from 'ee/related_items_tree/store/mutation_types';
...@@ -31,9 +29,6 @@ import { ...@@ -31,9 +29,6 @@ import {
mockEpic1, mockEpic1,
} from '../mock_data'; } from '../mock_data';
// eslint-disable-next-line import/no-deprecated
const mockProjects = getJSONFixture('static/projects.json');
jest.mock('~/flash'); jest.mock('~/flash');
describe('RelatedItemTree', () => { describe('RelatedItemTree', () => {
......
...@@ -54,6 +54,7 @@ module.exports = (path, options = {}) => { ...@@ -54,6 +54,7 @@ module.exports = (path, options = {}) => {
'^helpers(/.*)$': '<rootDir>/spec/frontend/__helpers__$1', '^helpers(/.*)$': '<rootDir>/spec/frontend/__helpers__$1',
'^vendor(/.*)$': '<rootDir>/vendor/assets/javascripts$1', '^vendor(/.*)$': '<rootDir>/vendor/assets/javascripts$1',
[TEST_FIXTURES_PATTERN]: '<rootDir>/tmp/tests/frontend/fixtures$1', [TEST_FIXTURES_PATTERN]: '<rootDir>/tmp/tests/frontend/fixtures$1',
'^test_fixtures_static(/.*)$': '<rootDir>/spec/frontend/fixtures/static$1',
'\\.(jpg|jpeg|png|svg|css)$': '<rootDir>/spec/frontend/__mocks__/file_mock.js', '\\.(jpg|jpeg|png|svg|css)$': '<rootDir>/spec/frontend/__mocks__/file_mock.js',
'emojis(/.*).json': '<rootDir>/fixtures/emojis$1.json', 'emojis(/.*).json': '<rootDir>/fixtures/emojis$1.json',
'^spec/test_constants$': '<rootDir>/spec/frontend/__helpers__/test_constants', '^spec/test_constants$': '<rootDir>/spec/frontend/__helpers__/test_constants',
......
/* eslint-disable no-param-reassign */ /* eslint-disable no-param-reassign */
import $ from 'jquery'; import $ from 'jquery';
import mockProjects from 'test_fixtures_static/projects.json';
import initDeprecatedJQueryDropdown from '~/deprecated_jquery_dropdown'; import initDeprecatedJQueryDropdown from '~/deprecated_jquery_dropdown';
import '~/lib/utils/common_utils'; import '~/lib/utils/common_utils';
// eslint-disable-next-line import/no-deprecated
import { getJSONFixture } from 'helpers/fixtures';
import { visitUrl } from '~/lib/utils/url_utility'; import { visitUrl } from '~/lib/utils/url_utility';
jest.mock('~/lib/utils/url_utility', () => ({ jest.mock('~/lib/utils/url_utility', () => ({
...@@ -68,8 +67,7 @@ describe('deprecatedJQueryDropdown', () => { ...@@ -68,8 +67,7 @@ describe('deprecatedJQueryDropdown', () => {
loadFixtures('static/deprecated_jquery_dropdown.html'); loadFixtures('static/deprecated_jquery_dropdown.html');
test.dropdownContainerElement = $('.dropdown.inline'); test.dropdownContainerElement = $('.dropdown.inline');
test.$dropdownMenuElement = $('.dropdown-menu', test.dropdownContainerElement); test.$dropdownMenuElement = $('.dropdown-menu', test.dropdownContainerElement);
// eslint-disable-next-line import/no-deprecated test.projectsData = JSON.parse(JSON.stringify(mockProjects));
test.projectsData = getJSONFixture('static/projects.json');
}); });
afterEach(() => { afterEach(() => {
......
// eslint-disable-next-line import/no-deprecated import { setHTMLFixture } from 'helpers/fixtures';
import { getJSONFixture, setHTMLFixture } from 'helpers/fixtures';
import FilterableList from '~/filterable_list'; import FilterableList from '~/filterable_list';
describe('FilterableList', () => { describe('FilterableList', () => {
...@@ -15,8 +14,6 @@ describe('FilterableList', () => { ...@@ -15,8 +14,6 @@ describe('FilterableList', () => {
</div> </div>
<div class="js-projects-list-holder"></div> <div class="js-projects-list-holder"></div>
`); `);
// eslint-disable-next-line import/no-deprecated
getJSONFixture('static/projects.json');
form = document.querySelector('form#project-filter-form'); form = document.querySelector('form#project-filter-form');
filter = document.querySelector('.js-projects-list-filter'); filter = document.querySelector('.js-projects-list-filter');
holder = document.querySelector('.js-projects-list-holder'); holder = document.querySelector('.js-projects-list-holder');
......
// eslint-disable-next-line import/no-deprecated import { setHTMLFixture } from 'helpers/fixtures';
import { getJSONFixture, setHTMLFixture } from 'helpers/fixtures';
import ProjectsFilterableList from '~/projects/projects_filterable_list'; import ProjectsFilterableList from '~/projects/projects_filterable_list';
describe('ProjectsFilterableList', () => { describe('ProjectsFilterableList', () => {
...@@ -15,8 +14,6 @@ describe('ProjectsFilterableList', () => { ...@@ -15,8 +14,6 @@ describe('ProjectsFilterableList', () => {
</div> </div>
<div class="js-projects-list-holder"></div> <div class="js-projects-list-holder"></div>
`); `);
// eslint-disable-next-line import/no-deprecated
getJSONFixture('static/projects.json');
form = document.querySelector('form#project-filter-form'); form = document.querySelector('form#project-filter-form');
filter = document.querySelector('.js-projects-list-filter'); filter = document.querySelector('.js-projects-list-filter');
holder = document.querySelector('.js-projects-list-holder'); holder = document.querySelector('.js-projects-list-holder');
......
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount, createLocalVue } from '@vue/test-utils';
// eslint-disable-next-line import/no-deprecated import mockProjects from 'test_fixtures_static/projects.json';
import { getJSONFixture } from 'helpers/fixtures';
import { trimText } from 'helpers/text_helper'; import { trimText } from 'helpers/text_helper';
import ProjectAvatar from '~/vue_shared/components/deprecated_project_avatar/default.vue'; import ProjectAvatar from '~/vue_shared/components/deprecated_project_avatar/default.vue';
import ProjectListItem from '~/vue_shared/components/project_selector/project_list_item.vue'; import ProjectListItem from '~/vue_shared/components/project_selector/project_list_item.vue';
...@@ -13,8 +12,7 @@ describe('ProjectListItem component', () => { ...@@ -13,8 +12,7 @@ describe('ProjectListItem component', () => {
let vm; let vm;
let options; let options;
// eslint-disable-next-line import/no-deprecated const project = JSON.parse(JSON.stringify(mockProjects))[0];
const project = getJSONFixture('static/projects.json')[0];
beforeEach(() => { beforeEach(() => {
options = { options = {
......
...@@ -2,8 +2,7 @@ import { GlSearchBoxByType, GlInfiniteScroll } from '@gitlab/ui'; ...@@ -2,8 +2,7 @@ import { GlSearchBoxByType, GlInfiniteScroll } from '@gitlab/ui';
import { mount, createLocalVue } from '@vue/test-utils'; import { mount, createLocalVue } from '@vue/test-utils';
import { head } from 'lodash'; import { head } from 'lodash';
import Vue from 'vue'; import Vue from 'vue';
// eslint-disable-next-line import/no-deprecated import mockProjects from 'test_fixtures_static/projects.json';
import { getJSONFixture } from 'helpers/fixtures';
import { trimText } from 'helpers/text_helper'; import { trimText } from 'helpers/text_helper';
import ProjectListItem from '~/vue_shared/components/project_selector/project_list_item.vue'; import ProjectListItem from '~/vue_shared/components/project_selector/project_list_item.vue';
import ProjectSelector from '~/vue_shared/components/project_selector/project_selector.vue'; import ProjectSelector from '~/vue_shared/components/project_selector/project_selector.vue';
...@@ -13,8 +12,7 @@ const localVue = createLocalVue(); ...@@ -13,8 +12,7 @@ const localVue = createLocalVue();
describe('ProjectSelector component', () => { describe('ProjectSelector component', () => {
let wrapper; let wrapper;
let vm; let vm;
// eslint-disable-next-line import/no-deprecated const allProjects = mockProjects;
const allProjects = getJSONFixture('static/projects.json');
const searchResults = allProjects.slice(0, 5); const searchResults = allProjects.slice(0, 5);
let selected = []; let selected = [];
selected = selected.concat(allProjects.slice(0, 3)).concat(allProjects.slice(5, 8)); selected = selected.concat(allProjects.slice(0, 3)).concat(allProjects.slice(5, 8));
......
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