diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-04 00:09:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-04 00:09:35 +0300 |
commit | e701659ba316541833e50d68f14720d17be58f8c (patch) | |
tree | 9e123fa2a749deaaf0a97612b05156576f55ff9f /spec/frontend/feature_flags | |
parent | c2a6cc86754adb3c5e064cebc58d206a52cb412e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/feature_flags')
-rw-r--r-- | spec/frontend/feature_flags/components/edit_feature_flag_spec.js | 34 | ||||
-rw-r--r-- | spec/frontend/feature_flags/components/new_feature_flag_spec.js | 45 |
2 files changed, 2 insertions, 77 deletions
diff --git a/spec/frontend/feature_flags/components/edit_feature_flag_spec.js b/spec/frontend/feature_flags/components/edit_feature_flag_spec.js index 6a394251060..f8e25925774 100644 --- a/spec/frontend/feature_flags/components/edit_feature_flag_spec.js +++ b/spec/frontend/feature_flags/components/edit_feature_flag_spec.js @@ -4,7 +4,7 @@ import MockAdapter from 'axios-mock-adapter'; import { GlToggle, GlAlert } from '@gitlab/ui'; import { TEST_HOST } from 'spec/test_constants'; import { mockTracking } from 'helpers/tracking_helper'; -import { LEGACY_FLAG, NEW_VERSION_FLAG, NEW_FLAG_ALERT } from '~/feature_flags/constants'; +import { LEGACY_FLAG, NEW_VERSION_FLAG } from '~/feature_flags/constants'; import Form from '~/feature_flags/components/form.vue'; import createStore from '~/feature_flags/store/edit'; import EditFeatureFlag from '~/feature_flags/components/edit_feature_flag.vue'; @@ -37,9 +37,6 @@ describe('Edit feature flag form', () => { showUserCallout: true, userCalloutId, userCalloutsPath, - glFeatures: { - featureFlagsNewVersion: true, - }, ...opts, }, }); @@ -151,33 +148,4 @@ describe('Edit feature flag form', () => { }); }); }); - - describe('without new version flags', () => { - beforeEach(() => factory({ glFeatures: { featureFlagsNewVersion: false } })); - - it('should alert users that feature flags are changing soon', () => { - expect(findAlert().text()).toBe(NEW_FLAG_ALERT); - }); - }); - - describe('dismissing new version alert', () => { - beforeEach(() => { - factory({ glFeatures: { featureFlagsNewVersion: false } }); - mock.onPost(userCalloutsPath, { feature_name: userCalloutId }).reply(200); - findAlert().vm.$emit('dismiss'); - return wrapper.vm.$nextTick(); - }); - - afterEach(() => { - mock.restore(); - }); - - it('should hide the alert', () => { - expect(findAlert().exists()).toBe(false); - }); - - it('should send the dismissal event', () => { - expect(mock.history.post.length).toBe(1); - }); - }); }); diff --git a/spec/frontend/feature_flags/components/new_feature_flag_spec.js b/spec/frontend/feature_flags/components/new_feature_flag_spec.js index dbc6e03d922..e317ac4b092 100644 --- a/spec/frontend/feature_flags/components/new_feature_flag_spec.js +++ b/spec/frontend/feature_flags/components/new_feature_flag_spec.js @@ -1,17 +1,11 @@ import { shallowMount, createLocalVue } from '@vue/test-utils'; import Vuex from 'vuex'; -import MockAdapter from 'axios-mock-adapter'; import { GlAlert } from '@gitlab/ui'; import { TEST_HOST } from 'spec/test_constants'; import Form from '~/feature_flags/components/form.vue'; import createStore from '~/feature_flags/store/new'; import NewFeatureFlag from '~/feature_flags/components/new_feature_flag.vue'; -import { - ROLLOUT_STRATEGY_ALL_USERS, - DEFAULT_PERCENT_ROLLOUT, - NEW_FLAG_ALERT, -} from '~/feature_flags/constants'; -import axios from '~/lib/utils/axios_utils'; +import { ROLLOUT_STRATEGY_ALL_USERS, DEFAULT_PERCENT_ROLLOUT } from '~/feature_flags/constants'; import { allUsersStrategy } from '../mock_data'; const userCalloutId = 'feature_flags_new_version'; @@ -42,9 +36,6 @@ describe('New feature flag form', () => { userCalloutsPath, environmentsEndpoint: 'environments.json', projectId: '8', - glFeatures: { - featureFlagsNewVersion: true, - }, ...opts, }, }); @@ -58,8 +49,6 @@ describe('New feature flag form', () => { wrapper.destroy(); }); - const findAlert = () => wrapper.find(GlAlert); - describe('with error', () => { it('should render the error', () => { store.dispatch('receiveCreateFeatureFlagError', { message: ['The name is required'] }); @@ -101,36 +90,4 @@ describe('New feature flag form', () => { expect(strategies).toEqual([allUsersStrategy]); }); - - describe('without new version flags', () => { - beforeEach(() => factory({ glFeatures: { featureFlagsNewVersion: false } })); - - it('should alert users that feature flags are changing soon', () => { - expect(findAlert().text()).toBe(NEW_FLAG_ALERT); - }); - }); - - describe('dismissing new version alert', () => { - let mock; - - beforeEach(() => { - mock = new MockAdapter(axios); - mock.onPost(userCalloutsPath, { feature_name: userCalloutId }).reply(200); - factory({ glFeatures: { featureFlagsNewVersion: false } }); - findAlert().vm.$emit('dismiss'); - return wrapper.vm.$nextTick(); - }); - - afterEach(() => { - mock.restore(); - }); - - it('should hide the alert', () => { - expect(findAlert().exists()).toBe(false); - }); - - it('should send the dismissal event', () => { - expect(mock.history.post.length).toBe(1); - }); - }); }); |