diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /spec/frontend/security_configuration/configuration_table_spec.js | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'spec/frontend/security_configuration/configuration_table_spec.js')
-rw-r--r-- | spec/frontend/security_configuration/configuration_table_spec.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/spec/frontend/security_configuration/configuration_table_spec.js b/spec/frontend/security_configuration/configuration_table_spec.js new file mode 100644 index 00000000000..49f9a7a3ea8 --- /dev/null +++ b/spec/frontend/security_configuration/configuration_table_spec.js @@ -0,0 +1,48 @@ +import { mount } from '@vue/test-utils'; +import { extendedWrapper } from 'helpers/vue_test_utils_helper'; +import ConfigurationTable from '~/security_configuration/components/configuration_table.vue'; +import { features, UPGRADE_CTA } from '~/security_configuration/components/features_constants'; + +import { + REPORT_TYPE_SAST, + REPORT_TYPE_DAST, + REPORT_TYPE_DEPENDENCY_SCANNING, + REPORT_TYPE_CONTAINER_SCANNING, + REPORT_TYPE_COVERAGE_FUZZING, + REPORT_TYPE_LICENSE_COMPLIANCE, +} from '~/vue_shared/security_reports/constants'; + +describe('Configuration Table Component', () => { + let wrapper; + + const createComponent = () => { + wrapper = extendedWrapper(mount(ConfigurationTable, {})); + }; + + afterEach(() => { + wrapper.destroy(); + }); + + beforeEach(() => { + createComponent(); + }); + + it.each(features)('should match strings', (feature) => { + expect(wrapper.text()).toContain(feature.name); + expect(wrapper.text()).toContain(feature.description); + + if (feature.type === REPORT_TYPE_SAST) { + expect(wrapper.findByTestId(feature.type).text()).toBe('Configure via Merge Request'); + } else if ( + [ + REPORT_TYPE_DAST, + REPORT_TYPE_DEPENDENCY_SCANNING, + REPORT_TYPE_CONTAINER_SCANNING, + REPORT_TYPE_COVERAGE_FUZZING, + REPORT_TYPE_LICENSE_COMPLIANCE, + ].includes(feature.type) + ) { + expect(wrapper.findByTestId(feature.type).text()).toMatchInterpolatedText(UPGRADE_CTA); + } + }); +}); |