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>2020-02-22 03:09:11 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-22 03:09:11 +0300
commitab85af0f318ccbcfdd508e7a2f85788f26831785 (patch)
tree497309067bd3ab4378f9d4bbf95859c64f95744f /spec/frontend/ci_variable_list/components/ci_variable_settings_spec.js
parenta6c2be7cd20a9515b347e72d63c5b47bb9b79457 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/ci_variable_list/components/ci_variable_settings_spec.js')
-rw-r--r--spec/frontend/ci_variable_list/components/ci_variable_settings_spec.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/frontend/ci_variable_list/components/ci_variable_settings_spec.js b/spec/frontend/ci_variable_list/components/ci_variable_settings_spec.js
new file mode 100644
index 00000000000..7dcd82eac5e
--- /dev/null
+++ b/spec/frontend/ci_variable_list/components/ci_variable_settings_spec.js
@@ -0,0 +1,39 @@
+import Vuex from 'vuex';
+import { createLocalVue, shallowMount } from '@vue/test-utils';
+import CiVariableSettings from '~/ci_variable_list/components/ci_variable_settings.vue';
+import createStore from '~/ci_variable_list/store';
+
+const localVue = createLocalVue();
+localVue.use(Vuex);
+
+describe('Ci variable table', () => {
+ let wrapper;
+ let store;
+ let isGroup;
+
+ const createComponent = groupState => {
+ store = createStore();
+ store.state.isGroup = groupState;
+ jest.spyOn(store, 'dispatch').mockImplementation();
+ wrapper = shallowMount(CiVariableSettings, {
+ localVue,
+ store,
+ });
+ };
+
+ afterEach(() => {
+ wrapper.destroy();
+ });
+
+ it('dispatches fetchEnvironments when mounted', () => {
+ isGroup = false;
+ createComponent(isGroup);
+ expect(store.dispatch).toHaveBeenCalledWith('fetchEnvironments');
+ });
+
+ it('does not dispatch fetchenvironments when in group context', () => {
+ isGroup = true;
+ createComponent(isGroup);
+ expect(store.dispatch).not.toHaveBeenCalled();
+ });
+});