Commit a8dd7d62 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch '342794-fixtures-followup' into 'master'

Import commit from fixture

See merge request gitlab-org/gitlab!72270
parents 1e80f482 c1d45ab6
import { GlModal, GlSearchBoxByType } from '@gitlab/ui'; import { GlModal, GlSearchBoxByType } from '@gitlab/ui';
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount, createLocalVue } from '@vue/test-utils';
import Vuex from 'vuex'; import Vuex from 'vuex';
import getDiffWithCommit from 'test_fixtures/merge_request_diffs/with_commit.json';
import AddReviewItemsModal from '~/add_context_commits_modal/components/add_context_commits_modal_wrapper.vue'; import AddReviewItemsModal from '~/add_context_commits_modal/components/add_context_commits_modal_wrapper.vue';
import * as actions from '~/add_context_commits_modal/store/actions'; import * as actions from '~/add_context_commits_modal/store/actions';
import mutations from '~/add_context_commits_modal/store/mutations'; import mutations from '~/add_context_commits_modal/store/mutations';
import defaultState from '~/add_context_commits_modal/store/state'; import defaultState from '~/add_context_commits_modal/store/state';
import getDiffWithCommit from '../../diffs/mock_data/diff_with_commit';
const localVue = createLocalVue(); const localVue = createLocalVue();
localVue.use(Vuex); localVue.use(Vuex);
...@@ -18,7 +18,7 @@ describe('AddContextCommitsModal', () => { ...@@ -18,7 +18,7 @@ describe('AddContextCommitsModal', () => {
const removeContextCommits = jest.fn(); const removeContextCommits = jest.fn();
const resetModalState = jest.fn(); const resetModalState = jest.fn();
const searchCommits = jest.fn(); const searchCommits = jest.fn();
const { commit } = getDiffWithCommit(); const { commit } = getDiffWithCommit;
const createWrapper = (props = {}) => { const createWrapper = (props = {}) => {
store = new Vuex.Store({ store = new Vuex.Store({
......
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import getDiffWithCommit from 'test_fixtures/merge_request_diffs/with_commit.json';
import ReviewTabContainer from '~/add_context_commits_modal/components/review_tab_container.vue'; import ReviewTabContainer from '~/add_context_commits_modal/components/review_tab_container.vue';
import CommitItem from '~/diffs/components/commit_item.vue'; import CommitItem from '~/diffs/components/commit_item.vue';
import getDiffWithCommit from '../../diffs/mock_data/diff_with_commit';
describe('ReviewTabContainer', () => { describe('ReviewTabContainer', () => {
let wrapper; let wrapper;
const { commit } = getDiffWithCommit(); const { commit } = getDiffWithCommit;
const createWrapper = (props = {}) => { const createWrapper = (props = {}) => {
wrapper = shallowMount(ReviewTabContainer, { wrapper = shallowMount(ReviewTabContainer, {
......
import getDiffWithCommit from 'test_fixtures/merge_request_diffs/with_commit.json';
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
import * as types from '~/add_context_commits_modal/store/mutation_types'; import * as types from '~/add_context_commits_modal/store/mutation_types';
import mutations from '~/add_context_commits_modal/store/mutations'; import mutations from '~/add_context_commits_modal/store/mutations';
import getDiffWithCommit from '../../diffs/mock_data/diff_with_commit';
describe('AddContextCommitsModalStoreMutations', () => { describe('AddContextCommitsModalStoreMutations', () => {
const { commit } = getDiffWithCommit(); const { commit } = getDiffWithCommit;
describe('SET_BASE_CONFIG', () => { describe('SET_BASE_CONFIG', () => {
it('should set contextCommitsPath, mergeRequestIid and projectId', () => { it('should set contextCommitsPath, mergeRequestIid and projectId', () => {
const state = {}; const state = {};
......
import { mount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import getDiffWithCommit from 'test_fixtures/merge_request_diffs/with_commit.json';
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
import { trimText } from 'helpers/text_helper'; import { trimText } from 'helpers/text_helper';
import Component from '~/diffs/components/commit_item.vue'; import Component from '~/diffs/components/commit_item.vue';
import { getTimeago } from '~/lib/utils/datetime_utility'; import { getTimeago } from '~/lib/utils/datetime_utility';
import CommitPipelineStatus from '~/projects/tree/components/commit_pipeline_status_component.vue'; import CommitPipelineStatus from '~/projects/tree/components/commit_pipeline_status_component.vue';
import getDiffWithCommit from '../mock_data/diff_with_commit';
jest.mock('~/user_popovers'); jest.mock('~/user_popovers');
...@@ -18,7 +18,7 @@ describe('diffs/components/commit_item', () => { ...@@ -18,7 +18,7 @@ describe('diffs/components/commit_item', () => {
let wrapper; let wrapper;
const timeago = getTimeago(); const timeago = getTimeago();
const { commit } = getDiffWithCommit(); const { commit } = getDiffWithCommit;
const getTitleElement = () => wrapper.find('.commit-row-message.item-title'); const getTitleElement = () => wrapper.find('.commit-row-message.item-title');
const getDescElement = () => wrapper.find('pre.commit-row-description'); const getDescElement = () => wrapper.find('pre.commit-row-description');
......
import { mount, createLocalVue } from '@vue/test-utils'; import { mount, createLocalVue } from '@vue/test-utils';
import Vuex from 'vuex'; import Vuex from 'vuex';
import getDiffWithCommit from 'test_fixtures/merge_request_diffs/with_commit.json';
import setWindowLocation from 'helpers/set_window_location_helper'; import setWindowLocation from 'helpers/set_window_location_helper';
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
import { trimText } from 'helpers/text_helper'; import { trimText } from 'helpers/text_helper';
import CompareVersionsComponent from '~/diffs/components/compare_versions.vue'; import CompareVersionsComponent from '~/diffs/components/compare_versions.vue';
import { createStore } from '~/mr_notes/stores'; import { createStore } from '~/mr_notes/stores';
import getDiffWithCommit from '../mock_data/diff_with_commit';
import diffsMockData from '../mock_data/merge_request_diffs'; import diffsMockData from '../mock_data/merge_request_diffs';
const localVue = createLocalVue(); const localVue = createLocalVue();
...@@ -22,7 +22,7 @@ describe('CompareVersions', () => { ...@@ -22,7 +22,7 @@ describe('CompareVersions', () => {
let wrapper; let wrapper;
let store; let store;
const targetBranchName = 'tmp-wine-dev'; const targetBranchName = 'tmp-wine-dev';
const { commit } = getDiffWithCommit(); const { commit } = getDiffWithCommit;
const createWrapper = (props = {}, commitArgs = {}, createCommit = true) => { const createWrapper = (props = {}, commitArgs = {}, createCommit = true) => {
if (createCommit) { if (createCommit) {
...@@ -150,7 +150,7 @@ describe('CompareVersions', () => { ...@@ -150,7 +150,7 @@ describe('CompareVersions', () => {
describe('commit', () => { describe('commit', () => {
beforeEach(() => { beforeEach(() => {
store.state.diffs.commit = getDiffWithCommit().commit; store.state.diffs.commit = getDiffWithCommit.commit;
createWrapper(); createWrapper();
}); });
......
import fixture from 'test_fixtures/merge_request_diffs/with_commit.json';
export default function getDiffWithCommit() {
return fixture;
}
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