Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-06-23 12:07:48 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-06-23 12:07:48 +0300
commit4a3d1b728146eca491a4be53a353613d98562254 (patch)
tree08af67555ad34030da6573ba176b069f1ac33022 /spec/frontend/vue_shared
parenta8b9ec7857cd3e0ed2692c7dd0a2ef7eb549d465 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/vue_shared')
-rw-r--r--spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/actions_spec.js19
-rw-r--r--spec/frontend/vue_shared/components/sidebar/labels_select_widget/store/actions_spec.js11
2 files changed, 9 insertions, 21 deletions
diff --git a/spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/actions_spec.js b/spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/actions_spec.js
index 3f11095cb04..46ade5d5857 100644
--- a/spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/actions_spec.js
+++ b/spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/actions_spec.js
@@ -1,11 +1,14 @@
import MockAdapter from 'axios-mock-adapter';
import testAction from 'helpers/vuex_action_helper';
+import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils';
import * as actions from '~/vue_shared/components/sidebar/labels_select_vue/store/actions';
import * as types from '~/vue_shared/components/sidebar/labels_select_vue/store/mutation_types';
import defaultState from '~/vue_shared/components/sidebar/labels_select_vue/store/state';
+jest.mock('~/flash');
+
describe('LabelsSelect Actions', () => {
let state;
const mockInitialState = {
@@ -91,10 +94,6 @@ describe('LabelsSelect Actions', () => {
});
describe('receiveLabelsFailure', () => {
- beforeEach(() => {
- setFixtures('<div class="flash-container"></div>');
- });
-
it('sets value `state.labelsFetchInProgress` to `false`', (done) => {
testAction(
actions.receiveLabelsFailure,
@@ -109,9 +108,7 @@ describe('LabelsSelect Actions', () => {
it('shows flash error', () => {
actions.receiveLabelsFailure({ commit: () => {} });
- expect(document.querySelector('.flash-container .flash-text').innerText.trim()).toBe(
- 'Error fetching labels.',
- );
+ expect(createFlash).toHaveBeenCalledWith({ message: 'Error fetching labels.' });
});
});
@@ -186,10 +183,6 @@ describe('LabelsSelect Actions', () => {
});
describe('receiveCreateLabelFailure', () => {
- beforeEach(() => {
- setFixtures('<div class="flash-container"></div>');
- });
-
it('sets value `state.labelCreateInProgress` to `false`', (done) => {
testAction(
actions.receiveCreateLabelFailure,
@@ -204,9 +197,7 @@ describe('LabelsSelect Actions', () => {
it('shows flash error', () => {
actions.receiveCreateLabelFailure({ commit: () => {} });
- expect(document.querySelector('.flash-container .flash-text').innerText.trim()).toBe(
- 'Error creating label.',
- );
+ expect(createFlash).toHaveBeenCalledWith({ message: 'Error creating label.' });
});
});
diff --git a/spec/frontend/vue_shared/components/sidebar/labels_select_widget/store/actions_spec.js b/spec/frontend/vue_shared/components/sidebar/labels_select_widget/store/actions_spec.js
index 7ef4b769b6b..27de7de2411 100644
--- a/spec/frontend/vue_shared/components/sidebar/labels_select_widget/store/actions_spec.js
+++ b/spec/frontend/vue_shared/components/sidebar/labels_select_widget/store/actions_spec.js
@@ -1,11 +1,14 @@
import MockAdapter from 'axios-mock-adapter';
import testAction from 'helpers/vuex_action_helper';
+import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils';
import * as actions from '~/vue_shared/components/sidebar/labels_select_widget/store/actions';
import * as types from '~/vue_shared/components/sidebar/labels_select_widget/store/mutation_types';
import defaultState from '~/vue_shared/components/sidebar/labels_select_widget/store/state';
+jest.mock('~/flash');
+
describe('LabelsSelect Actions', () => {
let state;
const mockInitialState = {
@@ -91,10 +94,6 @@ describe('LabelsSelect Actions', () => {
});
describe('receiveLabelsFailure', () => {
- beforeEach(() => {
- setFixtures('<div class="flash-container"></div>');
- });
-
it('sets value `state.labelsFetchInProgress` to `false`', (done) => {
testAction(
actions.receiveLabelsFailure,
@@ -109,9 +108,7 @@ describe('LabelsSelect Actions', () => {
it('shows flash error', () => {
actions.receiveLabelsFailure({ commit: () => {} });
- expect(document.querySelector('.flash-container .flash-text').innerText.trim()).toBe(
- 'Error fetching labels.',
- );
+ expect(createFlash).toHaveBeenCalledWith({ message: 'Error fetching labels.' });
});
});