diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-26 21:12:26 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-26 21:12:26 +0300 |
commit | a4aa229f7621a1982b4220bbd6db1fbceb738a2e (patch) | |
tree | fcd1137d144f6ed81c728d187e62eb8d2c1a10e3 /spec/frontend/security_configuration | |
parent | 74015980b5259072bbf27b432b9b08fda9d27945 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/security_configuration')
-rw-r--r-- | spec/frontend/security_configuration/components/app_spec.js | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/spec/frontend/security_configuration/components/app_spec.js b/spec/frontend/security_configuration/components/app_spec.js index d4ee9e6e43d..4e0ea6a9717 100644 --- a/spec/frontend/security_configuration/components/app_spec.js +++ b/spec/frontend/security_configuration/components/app_spec.js @@ -39,7 +39,11 @@ describe('App component', () => { let wrapper; let userCalloutDismissSpy; - const createComponent = ({ shouldShowCallout = true, ...propsData }) => { + const createComponent = ({ + shouldShowCallout = true, + secureVulnerabilityTraining = true, + ...propsData + }) => { userCalloutDismissSpy = jest.fn(); wrapper = extendedWrapper( @@ -50,6 +54,9 @@ describe('App component', () => { autoDevopsHelpPagePath, autoDevopsPath, projectPath, + glFeatures: { + secureVulnerabilityTraining, + }, }, stubs: { ...stubChildren(SecurityConfigurationApp), @@ -138,20 +145,20 @@ describe('App component', () => { expect(mainHeading.text()).toContain('Security Configuration'); }); - it('renders GlTab Component ', () => { - expect(findTab().exists()).toBe(true); - }); + describe('tabs', () => { + const expectedTabs = ['security-testing', 'compliance-testing', 'vulnerability-management']; - it('renders right amount of tabs with correct title ', () => { - expect(findTabs()).toHaveLength(2); - }); + it('renders GlTab Component', () => { + expect(findTab().exists()).toBe(true); + }); - it('renders security-testing tab', () => { - expect(findByTestId('security-testing-tab').exists()).toBe(true); - }); + it('renders correct amount of tabs', () => { + expect(findTabs()).toHaveLength(expectedTabs.length); + }); - it('renders compliance-testing tab', () => { - expect(findByTestId('compliance-testing-tab').exists()).toBe(true); + it.each(expectedTabs)('renders the %s tab', (tabName) => { + expect(findByTestId(`${tabName}-tab`).exists()).toBe(true); + }); }); it('renders right amount of feature cards for given props with correct props', () => { @@ -418,4 +425,22 @@ describe('App component', () => { expect(findSecurityViewHistoryLink().attributes('href')).toBe('test/historyPath'); }); }); + + describe('when secureVulnerabilityTraining feature flag is disabled', () => { + beforeEach(() => { + createComponent({ + augmentedSecurityFeatures: securityFeaturesMock, + augmentedComplianceFeatures: complianceFeaturesMock, + secureVulnerabilityTraining: false, + }); + }); + + it('renders correct amount of tabs', () => { + expect(findTabs()).toHaveLength(2); + }); + + it('does not render the vulnerability-management tab', () => { + expect(wrapper.findByTestId('vulnerability-management-tab').exists()).toBe(false); + }); + }); }); |