summaryrefslogtreecommitdiff
path: root/spec/javascripts/jobs
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascripts/jobs')
-rw-r--r--spec/javascripts/jobs/components/job_app_spec.js4
-rw-r--r--spec/javascripts/jobs/components/job_container_item_spec.js2
-rw-r--r--spec/javascripts/jobs/components/job_log_spec.js2
-rw-r--r--spec/javascripts/jobs/components/manual_variables_form_spec.js26
-rw-r--r--spec/javascripts/jobs/components/stages_dropdown_spec.js2
-rw-r--r--spec/javascripts/jobs/mixins/delayed_job_mixin_spec.js2
-rw-r--r--spec/javascripts/jobs/store/actions_spec.js4
7 files changed, 29 insertions, 13 deletions
diff --git a/spec/javascripts/jobs/components/job_app_spec.js b/spec/javascripts/jobs/components/job_app_spec.js
index 57ab1aa73f7..0fcd6080106 100644
--- a/spec/javascripts/jobs/components/job_app_spec.js
+++ b/spec/javascripts/jobs/components/job_app_spec.js
@@ -1,11 +1,11 @@
import Vue from 'vue';
import MockAdapter from 'axios-mock-adapter';
+import { mountComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
+import { waitForMutation } from 'spec/helpers/vue_test_utils_helper';
import axios from '~/lib/utils/axios_utils';
import jobApp from '~/jobs/components/job_app.vue';
import createStore from '~/jobs/store';
import * as types from '~/jobs/store/mutation_types';
-import { mountComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
-import { waitForMutation } from 'spec/helpers/vue_test_utils_helper';
import { resetStore } from '../store/helpers';
import job from '../mock_data';
diff --git a/spec/javascripts/jobs/components/job_container_item_spec.js b/spec/javascripts/jobs/components/job_container_item_spec.js
index 2d108f1ad7f..99f6d9a14d9 100644
--- a/spec/javascripts/jobs/components/job_container_item_spec.js
+++ b/spec/javascripts/jobs/components/job_container_item_spec.js
@@ -1,6 +1,6 @@
import Vue from 'vue';
-import JobContainerItem from '~/jobs/components/job_container_item.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
+import JobContainerItem from '~/jobs/components/job_container_item.vue';
import job from '../mock_data';
describe('JobContainerItem', () => {
diff --git a/spec/javascripts/jobs/components/job_log_spec.js b/spec/javascripts/jobs/components/job_log_spec.js
index 4d782e5bd0e..fcaf2b3bb64 100644
--- a/spec/javascripts/jobs/components/job_log_spec.js
+++ b/spec/javascripts/jobs/components/job_log_spec.js
@@ -1,7 +1,7 @@
import Vue from 'vue';
+import { mountComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
import component from '~/jobs/components/job_log.vue';
import createStore from '~/jobs/store';
-import { mountComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
import { resetStore } from '../store/helpers';
describe('Job Log', () => {
diff --git a/spec/javascripts/jobs/components/manual_variables_form_spec.js b/spec/javascripts/jobs/components/manual_variables_form_spec.js
index 093aa905185..1f2bf8674c1 100644
--- a/spec/javascripts/jobs/components/manual_variables_form_spec.js
+++ b/spec/javascripts/jobs/components/manual_variables_form_spec.js
@@ -1,9 +1,12 @@
-import { shallowMount } from '@vue/test-utils';
+import { shallowMount, createLocalVue } from '@vue/test-utils';
import { GlButton } from '@gitlab/ui';
import Form from '~/jobs/components/manual_variables_form.vue';
+const localVue = createLocalVue();
+
describe('Manual Variables Form', () => {
let wrapper;
+
const requiredProps = {
action: {
path: '/play',
@@ -14,8 +17,10 @@ describe('Manual Variables Form', () => {
};
const factory = (props = {}) => {
- wrapper = shallowMount(Form, {
+ wrapper = shallowMount(localVue.extend(Form), {
propsData: props,
+ localVue,
+ sync: false,
});
};
@@ -23,8 +28,15 @@ describe('Manual Variables Form', () => {
factory(requiredProps);
});
- afterEach(() => {
- wrapper.destroy();
+ afterEach(done => {
+ // The component has a `nextTick` callback after some events so we need
+ // to wait for those to finish before destroying.
+ setImmediate(() => {
+ wrapper.destroy();
+ wrapper = null;
+
+ done();
+ });
});
it('renders empty form with correct placeholders', () => {
@@ -71,7 +83,7 @@ describe('Manual Variables Form', () => {
});
describe('when deleting a variable', () => {
- it('removes the variable row', () => {
+ beforeEach(done => {
wrapper.vm.variables = [
{
key: 'new key',
@@ -80,6 +92,10 @@ describe('Manual Variables Form', () => {
},
];
+ wrapper.vm.$nextTick(done);
+ });
+
+ it('removes the variable row', () => {
wrapper.find(GlButton).vm.$emit('click');
expect(wrapper.vm.variables.length).toBe(0);
diff --git a/spec/javascripts/jobs/components/stages_dropdown_spec.js b/spec/javascripts/jobs/components/stages_dropdown_spec.js
index a34337310d6..e091aece564 100644
--- a/spec/javascripts/jobs/components/stages_dropdown_spec.js
+++ b/spec/javascripts/jobs/components/stages_dropdown_spec.js
@@ -1,6 +1,6 @@
import Vue from 'vue';
-import component from '~/jobs/components/stages_dropdown.vue';
import { trimText } from 'spec/helpers/text_helper';
+import component from '~/jobs/components/stages_dropdown.vue';
import mountComponent from '../../helpers/vue_mount_component_helper';
describe('Stages Dropdown', () => {
diff --git a/spec/javascripts/jobs/mixins/delayed_job_mixin_spec.js b/spec/javascripts/jobs/mixins/delayed_job_mixin_spec.js
index 48a6b80b365..b67187f1d50 100644
--- a/spec/javascripts/jobs/mixins/delayed_job_mixin_spec.js
+++ b/spec/javascripts/jobs/mixins/delayed_job_mixin_spec.js
@@ -1,6 +1,6 @@
import Vue from 'vue';
-import delayedJobMixin from '~/jobs/mixins/delayed_job_mixin';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
+import delayedJobMixin from '~/jobs/mixins/delayed_job_mixin';
describe('DelayedJobMixin', () => {
const delayedJobFixture = getJSONFixture('jobs/delayed.json');
diff --git a/spec/javascripts/jobs/store/actions_spec.js b/spec/javascripts/jobs/store/actions_spec.js
index 91d1942bdbf..c0e8dbf9b22 100644
--- a/spec/javascripts/jobs/store/actions_spec.js
+++ b/spec/javascripts/jobs/store/actions_spec.js
@@ -1,4 +1,6 @@
import MockAdapter from 'axios-mock-adapter';
+import testAction from 'spec/helpers/vuex_action_helper';
+import { TEST_HOST } from 'spec/test_constants';
import axios from '~/lib/utils/axios_utils';
import {
setJobEndpoint,
@@ -27,8 +29,6 @@ import {
} from '~/jobs/store/actions';
import state from '~/jobs/store/state';
import * as types from '~/jobs/store/mutation_types';
-import testAction from 'spec/helpers/vuex_action_helper';
-import { TEST_HOST } from 'spec/test_constants';
describe('Job State actions', () => {
let mockedState;