diff options
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.js | 27 |
1 files changed, 22 insertions, 5 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 index 8b5a0f7ae9d..5e459ee390f 100644 --- a/spec/frontend/ci_variable_list/components/ci_variable_settings_spec.js +++ b/spec/frontend/ci_variable_list/components/ci_variable_settings_spec.js @@ -17,40 +17,45 @@ describe('Ci variable table', () => { const defaultProps = { areScopedVariablesAvailable: true, + entity: 'project', environments: mapEnvironmentNames(mockEnvs), hideEnvironmentScope: false, isLoading: false, + maxVariableLimit: 5, variables: mockVariablesWithScopes(projectString), }; const findCiVariableTable = () => wrapper.findComponent(ciVariableTable); const findCiVariableModal = () => wrapper.findComponent(ciVariableModal); - const createComponent = () => { + const createComponent = ({ props = {} } = {}) => { wrapper = shallowMount(CiVariableSettings, { propsData: { ...defaultProps, + ...props, }, }); }; - beforeEach(() => { - createComponent(); - }); - afterEach(() => { wrapper.destroy(); }); describe('props passing', () => { it('passes props down correctly to the ci table', () => { + createComponent(); + expect(findCiVariableTable().props()).toEqual({ + entity: 'project', isLoading: defaultProps.isLoading, + maxVariableLimit: defaultProps.maxVariableLimit, variables: defaultProps.variables, }); }); it('passes props down correctly to the ci modal', async () => { + createComponent(); + findCiVariableTable().vm.$emit('set-selected-variable'); await nextTick(); @@ -66,6 +71,10 @@ describe('Ci variable table', () => { }); describe('modal mode', () => { + beforeEach(() => { + createComponent(); + }); + it('passes down ADD mode when receiving an empty variable', async () => { findCiVariableTable().vm.$emit('set-selected-variable'); await nextTick(); @@ -82,6 +91,10 @@ describe('Ci variable table', () => { }); describe('variable modal', () => { + beforeEach(() => { + createComponent(); + }); + it('is hidden by default', () => { expect(findCiVariableModal().exists()).toBe(false); }); @@ -112,6 +125,10 @@ describe('Ci variable table', () => { }); describe('variable events', () => { + beforeEach(() => { + createComponent(); + }); + it.each` eventName ${'add-variable'} |