diff options
Diffstat (limited to 'spec/frontend/ide/components')
21 files changed, 60 insertions, 61 deletions
diff --git a/spec/frontend/ide/components/activity_bar_spec.js b/spec/frontend/ide/components/activity_bar_spec.js index 8b3853d4535..762f3c5dad1 100644 --- a/spec/frontend/ide/components/activity_bar_spec.js +++ b/spec/frontend/ide/components/activity_bar_spec.js @@ -1,15 +1,17 @@ import Vue from 'vue'; -import store from '~/ide/stores'; +import { createStore } from '~/ide/stores'; import { leftSidebarViews } from '~/ide/constants'; import ActivityBar from '~/ide/components/activity_bar.vue'; import { createComponentWithStore } from '../../helpers/vue_mount_component_helper'; -import { resetStore } from '../helpers'; describe('IDE activity bar', () => { const Component = Vue.extend(ActivityBar); let vm; + let store; beforeEach(() => { + store = createStore(); + Vue.set(store.state.projects, 'abcproject', { web_url: 'testing', }); @@ -20,8 +22,6 @@ describe('IDE activity bar', () => { afterEach(() => { vm.$destroy(); - - resetStore(vm.$store); }); describe('updateActivityBarView', () => { diff --git a/spec/frontend/ide/components/commit_sidebar/empty_state_spec.js b/spec/frontend/ide/components/commit_sidebar/empty_state_spec.js index 16d0b354a30..dbb43e43c19 100644 --- a/spec/frontend/ide/components/commit_sidebar/empty_state_spec.js +++ b/spec/frontend/ide/components/commit_sidebar/empty_state_spec.js @@ -1,13 +1,15 @@ import Vue from 'vue'; -import store from '~/ide/stores'; +import { createStore } from '~/ide/stores'; import emptyState from '~/ide/components/commit_sidebar/empty_state.vue'; import { createComponentWithStore } from '../../../helpers/vue_mount_component_helper'; -import { resetStore } from '../../helpers'; describe('IDE commit panel empty state', () => { let vm; + let store; beforeEach(() => { + store = createStore(); + const Component = Vue.extend(emptyState); Vue.set(store.state, 'noChangesStateSvgPath', 'no-changes'); @@ -19,8 +21,6 @@ describe('IDE commit panel empty state', () => { afterEach(() => { vm.$destroy(); - - resetStore(vm.$store); }); it('renders no changes text when last commit message is empty', () => { diff --git a/spec/frontend/ide/components/commit_sidebar/form_spec.js b/spec/frontend/ide/components/commit_sidebar/form_spec.js index c62df4a3795..9245cefc183 100644 --- a/spec/frontend/ide/components/commit_sidebar/form_spec.js +++ b/spec/frontend/ide/components/commit_sidebar/form_spec.js @@ -1,19 +1,20 @@ import Vue from 'vue'; import { createComponentWithStore } from 'helpers/vue_mount_component_helper'; import { projectData } from 'jest/ide/mock_data'; -import store from '~/ide/stores'; +import waitForPromises from 'helpers/wait_for_promises'; +import { createStore } from '~/ide/stores'; import CommitForm from '~/ide/components/commit_sidebar/form.vue'; import { leftSidebarViews } from '~/ide/constants'; -import { resetStore } from '../../helpers'; -import waitForPromises from 'helpers/wait_for_promises'; describe('IDE commit form', () => { const Component = Vue.extend(CommitForm); let vm; + let store; const beginCommitButton = () => vm.$el.querySelector('[data-testid="begin-commit-button"]'); beforeEach(() => { + store = createStore(); store.state.changedFiles.push('test'); store.state.currentProjectId = 'abcproject'; store.state.currentBranchId = 'master'; @@ -24,8 +25,6 @@ describe('IDE commit form', () => { afterEach(() => { vm.$destroy(); - - resetStore(vm.$store); }); it('enables begin commit button when there are changes', () => { diff --git a/spec/frontend/ide/components/commit_sidebar/list_collapsed_spec.js b/spec/frontend/ide/components/commit_sidebar/list_collapsed_spec.js index 45372d18965..42e0a20bc7b 100644 --- a/spec/frontend/ide/components/commit_sidebar/list_collapsed_spec.js +++ b/spec/frontend/ide/components/commit_sidebar/list_collapsed_spec.js @@ -1,14 +1,17 @@ import Vue from 'vue'; import { createComponentWithStore } from 'helpers/vue_mount_component_helper'; -import store from '~/ide/stores'; +import { createStore } from '~/ide/stores'; import listCollapsed from '~/ide/components/commit_sidebar/list_collapsed.vue'; import { file } from '../../helpers'; import { removeWhitespace } from '../../../helpers/text_helper'; describe('Multi-file editor commit sidebar list collapsed', () => { let vm; + let store; beforeEach(() => { + store = createStore(); + const Component = Vue.extend(listCollapsed); vm = createComponentWithStore(Component, store, { diff --git a/spec/frontend/ide/components/commit_sidebar/list_spec.js b/spec/frontend/ide/components/commit_sidebar/list_spec.js index 2b5664ffc4e..2107ff96e95 100644 --- a/spec/frontend/ide/components/commit_sidebar/list_spec.js +++ b/spec/frontend/ide/components/commit_sidebar/list_spec.js @@ -1,13 +1,16 @@ import Vue from 'vue'; import { createComponentWithStore } from 'helpers/vue_mount_component_helper'; -import store from '~/ide/stores'; +import { createStore } from '~/ide/stores'; import commitSidebarList from '~/ide/components/commit_sidebar/list.vue'; -import { file, resetStore } from '../../helpers'; +import { file } from '../../helpers'; describe('Multi-file editor commit sidebar list', () => { + let store; let vm; beforeEach(() => { + store = createStore(); + const Component = Vue.extend(commitSidebarList); vm = createComponentWithStore(Component, store, { @@ -26,8 +29,6 @@ describe('Multi-file editor commit sidebar list', () => { afterEach(() => { vm.$destroy(); - - resetStore(vm.$store); }); describe('with a list of files', () => { diff --git a/spec/frontend/ide/components/commit_sidebar/radio_group_spec.js b/spec/frontend/ide/components/commit_sidebar/radio_group_spec.js index ac80ba58056..bf61f4bbe77 100644 --- a/spec/frontend/ide/components/commit_sidebar/radio_group_spec.js +++ b/spec/frontend/ide/components/commit_sidebar/radio_group_spec.js @@ -1,13 +1,15 @@ import Vue from 'vue'; import { createComponentWithStore } from 'helpers/vue_mount_component_helper'; -import { resetStore } from 'jest/ide/helpers'; -import store from '~/ide/stores'; +import { createStore } from '~/ide/stores'; import radioGroup from '~/ide/components/commit_sidebar/radio_group.vue'; describe('IDE commit sidebar radio group', () => { let vm; + let store; beforeEach(done => { + store = createStore(); + const Component = Vue.extend(radioGroup); store.state.commit.commitAction = '2'; @@ -25,8 +27,6 @@ describe('IDE commit sidebar radio group', () => { afterEach(() => { vm.$destroy(); - - resetStore(vm.$store); }); it('uses label if present', () => { diff --git a/spec/frontend/ide/components/commit_sidebar/success_message_spec.js b/spec/frontend/ide/components/commit_sidebar/success_message_spec.js index e1a432b81be..db13c90fbb9 100644 --- a/spec/frontend/ide/components/commit_sidebar/success_message_spec.js +++ b/spec/frontend/ide/components/commit_sidebar/success_message_spec.js @@ -1,13 +1,15 @@ import Vue from 'vue'; -import store from '~/ide/stores'; +import { createStore } from '~/ide/stores'; import successMessage from '~/ide/components/commit_sidebar/success_message.vue'; import { createComponentWithStore } from '../../../helpers/vue_mount_component_helper'; -import { resetStore } from '../../helpers'; describe('IDE commit panel successful commit state', () => { let vm; + let store; beforeEach(() => { + store = createStore(); + const Component = Vue.extend(successMessage); vm = createComponentWithStore(Component, store, { @@ -19,8 +21,6 @@ describe('IDE commit panel successful commit state', () => { afterEach(() => { vm.$destroy(); - - resetStore(vm.$store); }); it('renders last commit message when it exists', done => { diff --git a/spec/frontend/ide/components/file_row_extra_spec.js b/spec/frontend/ide/components/file_row_extra_spec.js index e78bacadebb..4bd27d23f76 100644 --- a/spec/frontend/ide/components/file_row_extra_spec.js +++ b/spec/frontend/ide/components/file_row_extra_spec.js @@ -2,7 +2,7 @@ import Vue from 'vue'; import { createComponentWithStore } from 'helpers/vue_mount_component_helper'; import { createStore } from '~/ide/stores'; import FileRowExtra from '~/ide/components/file_row_extra.vue'; -import { file, resetStore } from '../helpers'; +import { file } from '../helpers'; describe('IDE extra file row component', () => { let Component; @@ -32,7 +32,6 @@ describe('IDE extra file row component', () => { afterEach(() => { vm.$destroy(); - resetStore(vm.$store); stagedFilesCount = 0; unstagedFilesCount = 0; diff --git a/spec/frontend/ide/components/file_templates/bar_spec.js b/spec/frontend/ide/components/file_templates/bar_spec.js index 21dbe18a223..5a33837fb14 100644 --- a/spec/frontend/ide/components/file_templates/bar_spec.js +++ b/spec/frontend/ide/components/file_templates/bar_spec.js @@ -2,7 +2,7 @@ import Vue from 'vue'; import { mountComponentWithStore } from 'helpers/vue_mount_component_helper'; import { createStore } from '~/ide/stores'; import Bar from '~/ide/components/file_templates/bar.vue'; -import { resetStore, file } from '../../helpers'; +import { file } from '../../helpers'; describe('IDE file templates bar component', () => { let Component; @@ -26,7 +26,6 @@ describe('IDE file templates bar component', () => { afterEach(() => { vm.$destroy(); - resetStore(vm.$store); }); describe('template type dropdown', () => { diff --git a/spec/frontend/ide/components/ide_review_spec.js b/spec/frontend/ide/components/ide_review_spec.js index b56957e1f6d..c9ac2ac423d 100644 --- a/spec/frontend/ide/components/ide_review_spec.js +++ b/spec/frontend/ide/components/ide_review_spec.js @@ -3,7 +3,7 @@ import IdeReview from '~/ide/components/ide_review.vue'; import { createStore } from '~/ide/stores'; import { createComponentWithStore } from '../../helpers/vue_mount_component_helper'; import { trimText } from '../../helpers/text_helper'; -import { resetStore, file } from '../helpers'; +import { file } from '../helpers'; import { projectData } from '../mock_data'; describe('IDE review mode', () => { @@ -26,8 +26,6 @@ describe('IDE review mode', () => { afterEach(() => { vm.$destroy(); - - resetStore(vm.$store); }); it('renders list of files', () => { diff --git a/spec/frontend/ide/components/ide_side_bar_spec.js b/spec/frontend/ide/components/ide_side_bar_spec.js index 65cad2e7eb0..67257b40879 100644 --- a/spec/frontend/ide/components/ide_side_bar_spec.js +++ b/spec/frontend/ide/components/ide_side_bar_spec.js @@ -1,15 +1,17 @@ import Vue from 'vue'; import { createComponentWithStore } from 'helpers/vue_mount_component_helper'; -import store from '~/ide/stores'; +import { createStore } from '~/ide/stores'; import ideSidebar from '~/ide/components/ide_side_bar.vue'; import { leftSidebarViews } from '~/ide/constants'; -import { resetStore } from '../helpers'; import { projectData } from '../mock_data'; describe('IdeSidebar', () => { let vm; + let store; beforeEach(() => { + store = createStore(); + const Component = Vue.extend(ideSidebar); store.state.currentProjectId = 'abcproject'; @@ -20,8 +22,6 @@ describe('IdeSidebar', () => { afterEach(() => { vm.$destroy(); - - resetStore(vm.$store); }); it('renders a sidebar', () => { diff --git a/spec/frontend/ide/components/ide_spec.js b/spec/frontend/ide/components/ide_spec.js index efc1d984dec..a7b07a9f0e2 100644 --- a/spec/frontend/ide/components/ide_spec.js +++ b/spec/frontend/ide/components/ide_spec.js @@ -2,7 +2,7 @@ import Vue from 'vue'; import { createComponentWithStore } from 'helpers/vue_mount_component_helper'; import { createStore } from '~/ide/stores'; import ide from '~/ide/components/ide.vue'; -import { file, resetStore } from '../helpers'; +import { file } from '../helpers'; import { projectData } from '../mock_data'; import extendStore from '~/ide/stores/extend'; @@ -41,8 +41,6 @@ describe('ide component, empty repo', () => { afterEach(() => { vm.$destroy(); - - resetStore(vm.$store); }); it('renders "New file" button in empty repo', done => { @@ -63,8 +61,6 @@ describe('ide component, non-empty repo', () => { afterEach(() => { vm.$destroy(); - - resetStore(vm.$store); }); it('shows error message when set', done => { diff --git a/spec/frontend/ide/components/ide_tree_list_spec.js b/spec/frontend/ide/components/ide_tree_list_spec.js index 30f11db3153..4593ef6049b 100644 --- a/spec/frontend/ide/components/ide_tree_list_spec.js +++ b/spec/frontend/ide/components/ide_tree_list_spec.js @@ -1,8 +1,8 @@ import Vue from 'vue'; import IdeTreeList from '~/ide/components/ide_tree_list.vue'; -import store from '~/ide/stores'; +import { createStore } from '~/ide/stores'; import { createComponentWithStore } from '../../helpers/vue_mount_component_helper'; -import { resetStore, file } from '../helpers'; +import { file } from '../helpers'; import { projectData } from '../mock_data'; describe('IDE tree list', () => { @@ -10,6 +10,7 @@ describe('IDE tree list', () => { const normalBranchTree = [file('fileName')]; const emptyBranchTree = []; let vm; + let store; const bootstrapWithTree = (tree = normalBranchTree) => { store.state.currentProjectId = 'abcproject'; @@ -25,10 +26,12 @@ describe('IDE tree list', () => { }); }; + beforeEach(() => { + store = createStore(); + }); + afterEach(() => { vm.$destroy(); - - resetStore(vm.$store); }); describe('normal branch', () => { diff --git a/spec/frontend/ide/components/ide_tree_spec.js b/spec/frontend/ide/components/ide_tree_spec.js index 01f007f09c3..899daa0bf57 100644 --- a/spec/frontend/ide/components/ide_tree_spec.js +++ b/spec/frontend/ide/components/ide_tree_spec.js @@ -1,14 +1,17 @@ import Vue from 'vue'; import IdeTree from '~/ide/components/ide_tree.vue'; -import store from '~/ide/stores'; +import { createStore } from '~/ide/stores'; import { createComponentWithStore } from '../../helpers/vue_mount_component_helper'; -import { resetStore, file } from '../helpers'; +import { file } from '../helpers'; import { projectData } from '../mock_data'; describe('IdeRepoTree', () => { + let store; let vm; beforeEach(() => { + store = createStore(); + const IdeRepoTree = Vue.extend(IdeTree); store.state.currentProjectId = 'abcproject'; @@ -24,8 +27,6 @@ describe('IdeRepoTree', () => { afterEach(() => { vm.$destroy(); - - resetStore(vm.$store); }); it('renders list of files', () => { diff --git a/spec/frontend/ide/components/jobs/detail_spec.js b/spec/frontend/ide/components/jobs/detail_spec.js index 8f3815d5aab..acd30dee718 100644 --- a/spec/frontend/ide/components/jobs/detail_spec.js +++ b/spec/frontend/ide/components/jobs/detail_spec.js @@ -1,9 +1,9 @@ import Vue from 'vue'; +import { TEST_HOST } from 'helpers/test_constants'; import JobDetail from '~/ide/components/jobs/detail.vue'; import { createStore } from '~/ide/stores'; import { createComponentWithStore } from '../../../helpers/vue_mount_component_helper'; import { jobs } from '../../mock_data'; -import { TEST_HOST } from 'helpers/test_constants'; describe('IDE jobs detail view', () => { let vm; diff --git a/spec/frontend/ide/components/new_dropdown/index_spec.js b/spec/frontend/ide/components/new_dropdown/index_spec.js index 00781c16609..c6cebf36de3 100644 --- a/spec/frontend/ide/components/new_dropdown/index_spec.js +++ b/spec/frontend/ide/components/new_dropdown/index_spec.js @@ -1,13 +1,15 @@ import Vue from 'vue'; import { createComponentWithStore } from 'helpers/vue_mount_component_helper'; -import store from '~/ide/stores'; +import { createStore } from '~/ide/stores'; import newDropdown from '~/ide/components/new_dropdown/index.vue'; -import { resetStore } from '../../helpers'; describe('new dropdown component', () => { + let store; let vm; beforeEach(() => { + store = createStore(); + const component = Vue.extend(newDropdown); vm = createComponentWithStore(component, store, { @@ -30,8 +32,6 @@ describe('new dropdown component', () => { afterEach(() => { vm.$destroy(); - - resetStore(vm.$store); }); it('renders new file, upload and new directory links', () => { diff --git a/spec/frontend/ide/components/new_dropdown/modal_spec.js b/spec/frontend/ide/components/new_dropdown/modal_spec.js index da17cc3601e..ea8ba24c9d0 100644 --- a/spec/frontend/ide/components/new_dropdown/modal_spec.js +++ b/spec/frontend/ide/components/new_dropdown/modal_spec.js @@ -2,7 +2,7 @@ import Vue from 'vue'; import { createComponentWithStore } from 'helpers/vue_mount_component_helper'; import { createStore } from '~/ide/stores'; import modal from '~/ide/components/new_dropdown/modal.vue'; -import createFlash from '~/flash'; +import { deprecatedCreateFlash as createFlash } from '~/flash'; jest.mock('~/flash'); diff --git a/spec/frontend/ide/components/panes/collapsible_sidebar_spec.js b/spec/frontend/ide/components/panes/collapsible_sidebar_spec.js index e32abc98aae..bb9ba32a699 100644 --- a/spec/frontend/ide/components/panes/collapsible_sidebar_spec.js +++ b/spec/frontend/ide/components/panes/collapsible_sidebar_spec.js @@ -1,9 +1,9 @@ import { createLocalVue, shallowMount } from '@vue/test-utils'; +import Vuex from 'vuex'; import { createStore } from '~/ide/stores'; import paneModule from '~/ide/stores/modules/pane'; import CollapsibleSidebar from '~/ide/components/panes/collapsible_sidebar.vue'; import IdeSidebarNav from '~/ide/components/ide_sidebar_nav.vue'; -import Vuex from 'vuex'; const localVue = createLocalVue(); localVue.use(Vuex); diff --git a/spec/frontend/ide/components/pipelines/list_spec.js b/spec/frontend/ide/components/pipelines/list_spec.js index 795ded35d20..86cdbafaff9 100644 --- a/spec/frontend/ide/components/pipelines/list_spec.js +++ b/spec/frontend/ide/components/pipelines/list_spec.js @@ -2,11 +2,11 @@ import { shallowMount, createLocalVue } from '@vue/test-utils'; import Vuex from 'vuex'; import { GlLoadingIcon } from '@gitlab/ui'; import { TEST_HOST } from 'helpers/test_constants'; +import { pipelines } from 'jest/ide/mock_data'; import List from '~/ide/components/pipelines/list.vue'; import JobsList from '~/ide/components/jobs/list.vue'; import Tab from '~/vue_shared/components/tabs/tab.vue'; import CiIcon from '~/vue_shared/components/ci_icon.vue'; -import { pipelines } from 'jest/ide/mock_data'; import IDEServices from '~/ide/services'; const localVue = createLocalVue(); diff --git a/spec/frontend/ide/components/preview/navigator_spec.js b/spec/frontend/ide/components/preview/navigator_spec.js index aa15f391e77..ba5ac3bbbea 100644 --- a/spec/frontend/ide/components/preview/navigator_spec.js +++ b/spec/frontend/ide/components/preview/navigator_spec.js @@ -1,8 +1,8 @@ import { shallowMount } from '@vue/test-utils'; import { TEST_HOST } from 'helpers/test_constants'; import { GlLoadingIcon } from '@gitlab/ui'; -import ClientsideNavigator from '~/ide/components/preview/navigator.vue'; import { listen } from 'codesandbox-api'; +import ClientsideNavigator from '~/ide/components/preview/navigator.vue'; jest.mock('codesandbox-api', () => ({ listen: jest.fn().mockReturnValue(jest.fn()), diff --git a/spec/frontend/ide/components/repo_editor_spec.js b/spec/frontend/ide/components/repo_editor_spec.js index a4336b8f2eb..f0ae2ba732b 100644 --- a/spec/frontend/ide/components/repo_editor_spec.js +++ b/spec/frontend/ide/components/repo_editor_spec.js @@ -3,6 +3,8 @@ import Vue from 'vue'; import MockAdapter from 'axios-mock-adapter'; import '~/behaviors/markdown/render_gfm'; import { Range } from 'monaco-editor'; +import waitForPromises from 'helpers/wait_for_promises'; +import waitUsingRealTimer from 'helpers/wait_using_real_timer'; import axios from '~/lib/utils/axios_utils'; import service from '~/ide/services'; import { createStoreOptions } from '~/ide/stores'; @@ -15,10 +17,8 @@ import { viewerTypes, } from '~/ide/constants'; import { createComponentWithStore } from '../../helpers/vue_mount_component_helper'; -import waitForPromises from 'helpers/wait_for_promises'; import { file } from '../helpers'; import { exampleConfigs, exampleFiles } from '../lib/editorconfig/mock_data'; -import waitUsingRealTimer from 'helpers/wait_using_real_timer'; describe('RepoEditor', () => { let vm; |