diff options
Diffstat (limited to 'spec/frontend/environments')
-rw-r--r-- | spec/frontend/environments/edit_environment_spec.js | 1 | ||||
-rw-r--r-- | spec/frontend/environments/environment_form_spec.js | 9 | ||||
-rw-r--r-- | spec/frontend/environments/new_environment_spec.js | 5 |
3 files changed, 13 insertions, 2 deletions
diff --git a/spec/frontend/environments/edit_environment_spec.js b/spec/frontend/environments/edit_environment_spec.js index 5ea23af4c16..ba4b4db54ff 100644 --- a/spec/frontend/environments/edit_environment_spec.js +++ b/spec/frontend/environments/edit_environment_spec.js @@ -14,6 +14,7 @@ const DEFAULT_OPTS = { provide: { projectEnvironmentsPath: '/projects/environments', updateEnvironmentPath: '/proejcts/environments/1', + protectedEnvironmentSettingsPath: '/projects/1/settings/ci_cd', }, propsData: { environment: { id: '0', name: 'foo', external_url: 'https://foo.example.com' } }, }; diff --git a/spec/frontend/environments/environment_form_spec.js b/spec/frontend/environments/environment_form_spec.js index f1af08bcf32..b9b34bee80f 100644 --- a/spec/frontend/environments/environment_form_spec.js +++ b/spec/frontend/environments/environment_form_spec.js @@ -10,11 +10,14 @@ const DEFAULT_PROPS = { cancelPath: '/cancel', }; +const PROVIDE = { protectedEnvironmentSettingsPath: '/projects/not_real/settings/ci_cd' }; + describe('~/environments/components/form.vue', () => { let wrapper; const createWrapper = (propsData = {}) => mountExtended(EnvironmentForm, { + provide: PROVIDE, propsData: { ...DEFAULT_PROPS, ...propsData, @@ -31,7 +34,7 @@ describe('~/environments/components/form.vue', () => { }); it('links to documentation regarding environments', () => { - const link = wrapper.findByRole('link', { name: 'More information' }); + const link = wrapper.findByRole('link', { name: 'More information.' }); expect(link.attributes('href')).toBe('/help/ci/environments/index.md'); }); @@ -124,6 +127,10 @@ describe('~/environments/components/form.vue', () => { expect(urlInput.element.value).toBe(''); }); + + it('does not show protected environment documentation', () => { + expect(wrapper.findByRole('link', { name: 'Protected environments' }).exists()).toBe(false); + }); }); describe('when an existing environment is being edited', () => { diff --git a/spec/frontend/environments/new_environment_spec.js b/spec/frontend/environments/new_environment_spec.js index 6dd4eea7437..5dd77759391 100644 --- a/spec/frontend/environments/new_environment_spec.js +++ b/spec/frontend/environments/new_environment_spec.js @@ -11,7 +11,10 @@ jest.mock('~/lib/utils/url_utility'); jest.mock('~/flash'); const DEFAULT_OPTS = { - provide: { projectEnvironmentsPath: '/projects/environments' }, + provide: { + projectEnvironmentsPath: '/projects/environments', + protectedEnvironmentSettingsPath: '/projects/not_real/settings/ci_cd', + }, }; describe('~/environments/components/new.vue', () => { |