summaryrefslogtreecommitdiff
path: root/spec/frontend/security_configuration/configuration_table_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/security_configuration/configuration_table_spec.js')
-rw-r--r--spec/frontend/security_configuration/configuration_table_spec.js48
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);
+ }
+ });
+});