Commit 1d98c6c6 authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Merge branch '339346-import-static-fixtures' into 'master'

Change getJSONFixture on static fixture to import [RUN-AS-IF-FOSS]

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