Commit acd5fbf6 authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch 'remove-preload-fixtures-from-jest-specs' into 'master'

[RUN-AS-IF-FOSS] Remove "preloadFixtures" and "loadJSONFixtures" from jest specs

See merge request gitlab-org/gitlab!55590
parents a9f10f16 8af3ca9d
describe('Sidebar', () => {
preloadFixtures('issues/open-issue.html');
beforeEach(() => loadFixtures('issues/open-issue.html'));
it('does not have a max select', () => {
......
......@@ -19,7 +19,6 @@ jest.mock('ee/saml_providers/scim_token_service', () => {
describe('SCIMTokenToggleArea', () => {
const FIXTURE = 'groups/saml_providers/show.html';
let scimTokenToggleArea;
preloadFixtures(FIXTURE);
beforeEach(() => {
loadFixtures(FIXTURE);
......
......@@ -5,8 +5,6 @@ const ceFixture = 'search/blob_search_result.html';
const searchKeyword = 'Send'; // spec/frontend/fixtures/search.rb#79
describe('ee/search/highlight_blob_search_result', () => {
preloadFixtures(fixture, ceFixture);
// Basic search support
it('highlights lines with search term occurrence', () => {
loadFixtures(ceFixture);
......
......@@ -14,7 +14,6 @@ settings:
globals:
getJSONFixture: false
loadFixtures: false
preloadFixtures: false
setFixtures: false
rules:
jest/expect-expect:
......
......@@ -8,8 +8,6 @@ describe('U2FAuthenticate', () => {
let container;
let component;
preloadFixtures('u2f/authenticate.html');
beforeEach(() => {
loadFixtures('u2f/authenticate.html');
u2fDevice = new MockU2FDevice();
......
......@@ -8,8 +8,6 @@ describe('U2FRegister', () => {
let container;
let component;
preloadFixtures('u2f/register.html');
beforeEach((done) => {
loadFixtures('u2f/register.html');
u2fDevice = new MockU2FDevice();
......
......@@ -13,7 +13,6 @@ const mockResponse = {
};
describe('WebAuthnAuthenticate', () => {
preloadFixtures('webauthn/authenticate.html');
useMockNavigatorCredentials();
let fallbackElement;
......
......@@ -5,7 +5,6 @@ import MockWebAuthnDevice from './mock_webauthn_device';
import { useMockNavigatorCredentials } from './util';
describe('WebAuthnRegister', () => {
preloadFixtures('webauthn/register.html');
useMockNavigatorCredentials();
const mockResponse = {
......
......@@ -60,7 +60,6 @@ describe('AwardsHandler', () => {
u: '6.0',
},
};
preloadFixtures('snippets/show.html');
const openAndWaitForEmojiMenu = (sel = '.js-add-award') => {
$(sel).eq(0).click();
......
......@@ -6,8 +6,6 @@ describe('Quick Submit behavior', () => {
const keydownEvent = (options = { keyCode: 13, metaKey: true }) => $.Event('keydown', options);
preloadFixtures('snippets/show.html');
beforeEach(() => {
loadFixtures('snippets/show.html');
......
......@@ -3,7 +3,6 @@ import '~/behaviors/requires_input';
describe('requiresInput', () => {
let submitButton;
preloadFixtures('branches/new_branch.html');
beforeEach(() => {
loadFixtures('branches/new_branch.html');
......
......@@ -13,8 +13,6 @@ describe('ShortcutsIssuable', () => {
const snippetShowFixtureName = 'snippets/show.html';
const mrShowFixtureName = 'merge_requests/merge_request_of_current_user.html';
preloadFixtures(snippetShowFixtureName, mrShowFixtureName);
beforeAll((done) => {
initCopyAsGFM();
......
......@@ -7,7 +7,6 @@ jest.mock('~/projects/upload_file_experiment', () => ({
}));
describe('BlobFileDropzone', () => {
preloadFixtures('blob/show.html');
let dropzone;
let replaceFileButton;
......
......@@ -4,8 +4,6 @@ import SketchLoader from '~/blob/sketch';
jest.mock('jszip');
describe('Sketch viewer', () => {
preloadFixtures('static/sketch_viewer.html');
beforeEach(() => {
loadFixtures('static/sketch_viewer.html');
});
......
......@@ -16,8 +16,6 @@ describe('Blob viewer', () => {
setTestTimeout(2000);
preloadFixtures('blob/show_readme.html');
beforeEach(() => {
$.fn.extend(jQueryMock);
mock = new MockAdapter(axios);
......
import LinkedTabs from '~/lib/utils/bootstrap_linked_tabs';
describe('Linked Tabs', () => {
preloadFixtures('static/linked_tabs.html');
beforeEach(() => {
loadFixtures('static/linked_tabs.html');
});
......
......@@ -4,9 +4,6 @@ import VariableList from '~/ci_variable_list/ci_variable_list';
const HIDE_CLASS = 'hide';
describe('VariableList', () => {
preloadFixtures('pipeline_schedules/edit.html');
preloadFixtures('pipeline_schedules/edit_with_variables.html');
let $wrapper;
let variableList;
......
......@@ -2,8 +2,6 @@ import $ from 'jquery';
import setupNativeFormVariableList from '~/ci_variable_list/native_form_variable_list';
describe('NativeFormVariableList', () => {
preloadFixtures('pipeline_schedules/edit.html');
let $wrapper;
beforeEach(() => {
......
......@@ -14,9 +14,6 @@ describe('Issuable right sidebar collapsed todo toggle', () => {
const jsonFixtureName = 'todos/todos.json';
let mock;
preloadFixtures(fixtureName);
preloadFixtures(jsonFixtureName);
beforeEach(() => {
const todoData = getJSONFixture(jsonFixtureName);
new Sidebar();
......
......@@ -17,8 +17,6 @@ describe('Pipelines table in Commits and Merge requests', () => {
errorStateSvgPath: 'foo',
};
preloadFixtures(jsonFixtureName);
const findRunPipelineBtn = () => vm.$el.querySelector('[data-testid="run_pipeline_button"]');
const findRunPipelineBtnMobile = () =>
vm.$el.querySelector('[data-testid="run_pipeline_button_mobile"]');
......
......@@ -20,8 +20,6 @@ const DROPDOWN_ITEM_DATA = [
];
describe('CreateItemDropdown', () => {
preloadFixtures('static/create_item_dropdown.html');
let $wrapperEl;
let createItemDropdown;
......
......@@ -10,8 +10,6 @@ jest.mock('~/lib/utils/url_utility', () => ({
}));
describe('deprecatedJQueryDropdown', () => {
preloadFixtures('static/deprecated_jquery_dropdown.html');
const NON_SELECTABLE_CLASSES =
'.divider, .separator, .dropdown-header, .dropdown-menu-empty-item';
const SEARCH_INPUT_SELECTOR = '.dropdown-input-field';
......
const FIXTURE = 'merge_request_diffs/with_commit.json';
preloadFixtures(FIXTURE);
export default function getDiffWithCommit() {
return getJSONFixture(FIXTURE);
}
......@@ -78,7 +78,6 @@ describe('Dropdown User', () => {
describe('hideCurrentUser', () => {
const fixtureTemplate = 'issues/issue_list.html';
preloadFixtures(fixtureTemplate);
let dropdown;
let authorFilterDropdownElement;
......
......@@ -5,7 +5,6 @@ import IssuableFilteredSearchTokenKeys from '~/filtered_search/issuable_filtered
describe('Dropdown Utils', () => {
const issueListFixture = 'issues/issue_list.html';
preloadFixtures(issueListFixture);
describe('getEscapedText', () => {
it('should return same word when it has no space', () => {
......
......@@ -133,8 +133,6 @@ describe('Filtered Search Visual Tokens', () => {
const jsonFixtureName = 'labels/project_labels.json';
const dummyEndpoint = '/dummy/endpoint';
preloadFixtures(jsonFixtureName);
let labelData;
beforeAll(() => {
......
......@@ -8,8 +8,6 @@ describe('GL Style Field Errors', () => {
testContext = {};
});
preloadFixtures('static/gl_field_errors.html');
beforeEach(() => {
loadFixtures('static/gl_field_errors.html');
const $form = $('form.gl-show-field-errors');
......
......@@ -15,7 +15,6 @@ describe('Header', () => {
$(document).trigger('todo:toggle', newCount);
}
preloadFixtures(fixtureTemplate);
beforeEach(() => {
initTodoToggle();
loadFixtures(fixtureTemplate);
......
......@@ -7,7 +7,6 @@ jest.mock('~/vue_shared/plugins/global_toast');
describe('IntegrationSettingsForm', () => {
const FIXTURE = 'services/edit_service.html';
preloadFixtures(FIXTURE);
beforeEach(() => {
loadFixtures(FIXTURE);
......
......@@ -8,11 +8,6 @@ describe('Issue', () => {
let testContext;
let mock;
beforeAll(() => {
preloadFixtures('issues/closed-issue.html');
preloadFixtures('issues/open-issue.html');
});
beforeEach(() => {
mock = new MockAdapter(axios);
mock.onGet(/(.*)\/related_branches$/).reply(200, {});
......
......@@ -7,7 +7,6 @@ import LineHighlighter from '~/line_highlighter';
describe('LineHighlighter', () => {
const testContext = {};
preloadFixtures('static/line_highlighter.html');
const clickLine = (number, eventData = {}) => {
if ($.isEmptyObject(eventData)) {
return $(`#L${number}`).click();
......
......@@ -9,7 +9,6 @@ describe('MergeRequest', () => {
describe('task lists', () => {
let mock;
preloadFixtures('merge_requests/merge_request_with_task_list.html');
beforeEach(() => {
loadFixtures('merge_requests/merge_request_with_task_list.html');
......
......@@ -21,11 +21,6 @@ describe('MergeRequestTabs', () => {
$.extend(stubLocation, defaults, stubs || {});
};
preloadFixtures(
'merge_requests/merge_request_with_task_list.html',
'merge_requests/diff_comment.html',
);
beforeEach(() => {
initMrPage();
......
......@@ -5,8 +5,6 @@ import axios from '~/lib/utils/axios_utils';
import MiniPipelineGraph from '~/mini_pipeline_graph_dropdown';
describe('Mini Pipeline Graph Dropdown', () => {
preloadFixtures('static/mini_dropdown_graph.html');
beforeEach(() => {
loadFixtures('static/mini_dropdown_graph.html');
});
......
......@@ -9,8 +9,6 @@ describe('Branch', () => {
});
describe('create a new branch', () => {
preloadFixtures('branches/new_branch.html');
function fillNameWith(value) {
$('.js-branch-name').val(value).trigger('blur');
}
......
......@@ -6,14 +6,10 @@ import createStore from '~/notes/stores';
import mockDiffFile from '../../diffs/mock_data/diff_discussions';
import { discussionMock } from '../mock_data';
const discussionWithTwoUnresolvedNotes = 'merge_requests/resolved_diff_discussion.json';
describe('diff_discussion_header component', () => {
let store;
let wrapper;
preloadFixtures(discussionWithTwoUnresolvedNotes);
beforeEach(() => {
window.mrTabs = {};
store = createStore();
......
......@@ -24,8 +24,6 @@ describe('noteable_discussion component', () => {
let wrapper;
let originalGon;
preloadFixtures(discussionWithTwoUnresolvedNotes);
beforeEach(() => {
window.mrTabs = {};
store = createStore();
......
......@@ -26,8 +26,6 @@ const createDiscussionNeighborParams = (discussionId, diffOrder, step) => ({
describe('Getters Notes Store', () => {
let state;
preloadFixtures(discussionWithTwoUnresolvedNotes);
beforeEach(() => {
state = {
discussions: [individualNote],
......
......@@ -6,8 +6,6 @@ describe('OAuthRememberMe', () => {
return $(`#oauth-container .oauth-login${selector}`).parent('form').attr('action');
};
preloadFixtures('static/oauth_remember_me.html');
beforeEach(() => {
loadFixtures('static/oauth_remember_me.html');
......
......@@ -14,8 +14,6 @@ describe('Abuse Reports', () => {
const findMessage = (searchText) =>
$messages.filter((index, element) => element.innerText.indexOf(searchText) > -1).first();
preloadFixtures(FIXTURE);
beforeEach(() => {
loadFixtures(FIXTURE);
new AbuseReports(); // eslint-disable-line no-new
......
......@@ -8,7 +8,6 @@ describe('AccountAndLimits', () => {
const FIXTURE = 'application_settings/accounts_and_limit.html';
let $userDefaultExternal;
let $userInternalRegex;
preloadFixtures(FIXTURE);
beforeEach(() => {
loadFixtures(FIXTURE);
......
......@@ -7,8 +7,6 @@ describe('UserInternalRegexHandler', () => {
let $userEmail;
let $warningMessage;
preloadFixtures(FIXTURE);
beforeEach(() => {
loadFixtures(FIXTURE);
// eslint-disable-next-line no-new
......
......@@ -14,7 +14,6 @@ const TEST_COUNT_BIG = 2000;
const TEST_DONE_COUNT_BIG = 7300;
describe('Todos', () => {
preloadFixtures('todos/todos.html');
let todoItem;
let mock;
......
......@@ -6,8 +6,6 @@ import TimezoneDropdown, {
} from '~/pages/projects/pipeline_schedules/shared/components/timezone_dropdown';
describe('Timezone Dropdown', () => {
preloadFixtures('pipeline_schedules/edit.html');
let $inputEl = null;
let $dropdownEl = null;
let $wrapper = null;
......
......@@ -6,8 +6,6 @@ describe('preserve_url_fragment', () => {
return $(`.omniauth-container ${selector}`).parent('form').attr('action');
};
preloadFixtures('sessions/new.html');
beforeEach(() => {
loadFixtures('sessions/new.html');
});
......
......@@ -18,8 +18,6 @@ describe('SigninTabsMemoizer', () => {
return memo;
}
preloadFixtures(fixtureTemplate);
beforeEach(() => {
loadFixtures(fixtureTemplate);
......
......@@ -19,8 +19,6 @@ describe('Pipelines Table Row', () => {
let pipelineWithoutAuthor;
let pipelineWithoutCommit;
preloadFixtures(jsonFixtureName);
beforeEach(() => {
const { pipelines } = getJSONFixture(jsonFixtureName);
......
......@@ -52,8 +52,6 @@ describe('Pipelines Table', () => {
const findTimeAgoTh = () => wrapper.findByTestId('timeago-th');
const findActionsTh = () => wrapper.findByTestId('actions-th');
preloadFixtures(jsonFixtureName);
beforeEach(() => {
const { pipelines } = getJSONFixture(jsonFixtureName);
pipeline = pipelines.find((p) => p.user !== null && p.commit !== null);
......
import Pipelines from '~/pipelines';
describe('Pipelines', () => {
preloadFixtures('static/pipeline_graph.html');
beforeEach(() => {
loadFixtures('static/pipeline_graph.html');
});
......
......@@ -10,8 +10,6 @@ describe('Project Select Combo Button', () => {
testContext = {};
});
preloadFixtures(fixturePath);
beforeEach(() => {
testContext.defaults = {
label: 'Select project to create issue',
......
......@@ -9,7 +9,6 @@ describe('PrometheusMetrics', () => {
const customMetricsEndpoint =
'http://test.host/frontend-fixtures/services-project/prometheus/metrics';
let mock;
preloadFixtures(FIXTURE);
beforeEach(() => {
mock = new MockAdapter(axios);
......
......@@ -6,7 +6,6 @@ import { metrics2 as metrics, missingVarMetrics } from './mock_data';
describe('PrometheusMetrics', () => {
const FIXTURE = 'services/prometheus/prometheus_service.html';
preloadFixtures(FIXTURE);
beforeEach(() => {
loadFixtures(FIXTURE);
......
......@@ -3,8 +3,6 @@ import initReadMore from '~/read_more';
describe('Read more click-to-expand functionality', () => {
const fixtureName = 'projects/overview.html';
preloadFixtures(fixtureName);
beforeEach(() => {
loadFixtures(fixtureName);
});
......
......@@ -27,7 +27,6 @@ const assertSidebarState = (state) => {
describe('RightSidebar', () => {
describe('fixture tests', () => {
const fixtureName = 'issues/open-issue.html';
preloadFixtures(fixtureName);
let mock;
beforeEach(() => {
......
......@@ -4,8 +4,6 @@ const fixture = 'search/blob_search_result.html';
const searchKeyword = 'Send'; // spec/frontend/fixtures/search.rb#79
describe('search/highlight_blob_search_result', () => {
preloadFixtures(fixture);
beforeEach(() => loadFixtures(fixture));
it('highlights lines with search term occurrence', () => {
......
......@@ -105,7 +105,6 @@ describe('Search autocomplete dropdown', () => {
expect(list.find(mrsIHaveCreatedLink).text()).toBe("Merge requests I've created");
};
preloadFixtures('static/search_autocomplete.html');
beforeEach(() => {
loadFixtures('static/search_autocomplete.html');
......
......@@ -2,8 +2,6 @@ import $ from 'jquery';
import initSettingsPanels, { isExpanded } from '~/settings_panels';
describe('Settings Panels', () => {
preloadFixtures('groups/edit.html');
beforeEach(() => {
loadFixtures('groups/edit.html');
});
......
......@@ -20,8 +20,6 @@ describe('Shortcuts', () => {
target,
});
preloadFixtures(fixtureName);
beforeEach(() => {
loadFixtures(fixtureName);
......
......@@ -44,11 +44,6 @@ Object.assign(global, {
getJSONFixture,
loadFixtures: loadHTMLFixture,
setFixtures: setHTMLFixture,
// The following functions fill the fixtures cache in Karma.
// This is not necessary in Jest because we make no Ajax request.
loadJSONFixtures() {},
preloadFixtures() {},
});
// custom-jquery-matchers was written for an old Jest version, we need to make it compatible
......
......@@ -3,7 +3,6 @@ import initUserPopovers from '~/user_popovers';
describe('User Popovers', () => {
const fixtureTemplate = 'merge_requests/merge_request_with_mentions.html';
preloadFixtures(fixtureTemplate);
const selector = '.js-user-link, .gfm-project_member';
const findFixtureLinks = () => {
......
......@@ -18,7 +18,6 @@ const DEFAULT_PROPS = {
describe('User Popover Component', () => {
const fixtureTemplate = 'merge_requests/diff_comment.html';
preloadFixtures(fixtureTemplate);
let wrapper;
......
......@@ -13,8 +13,6 @@ describe('ZenMode', () => {
let dropzoneForElementSpy;
const fixtureName = 'snippets/show.html';
preloadFixtures(fixtureName);
function enterZen() {
$('.notes-form .js-zen-enter').click();
}
......
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