Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-16 21:18:33 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-16 21:18:33 +0300
commitf64a639bcfa1fc2bc89ca7db268f594306edfd7c (patch)
treea2c3c2ebcc3b45e596949db485d6ed18ffaacfa1 /spec/frontend/security_configuration
parentbfbc3e0d6583ea1a91f627528bedc3d65ba4b10f (diff)
Add latest changes from gitlab-org/gitlab@13-10-stable-eev13.10.0-rc40
Diffstat (limited to 'spec/frontend/security_configuration')
-rw-r--r--spec/frontend/security_configuration/configuration_table_spec.js42
-rw-r--r--spec/frontend/security_configuration/upgrade_spec.js19
2 files changed, 29 insertions, 32 deletions
diff --git a/spec/frontend/security_configuration/configuration_table_spec.js b/spec/frontend/security_configuration/configuration_table_spec.js
index 49f9a7a3ea8..b8a574dc4e0 100644
--- a/spec/frontend/security_configuration/configuration_table_spec.js
+++ b/spec/frontend/security_configuration/configuration_table_spec.js
@@ -1,15 +1,11 @@
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 { scanners, UPGRADE_CTA } from '~/security_configuration/components/scanners_constants';
import {
REPORT_TYPE_SAST,
- REPORT_TYPE_DAST,
- REPORT_TYPE_DEPENDENCY_SCANNING,
- REPORT_TYPE_CONTAINER_SCANNING,
- REPORT_TYPE_COVERAGE_FUZZING,
- REPORT_TYPE_LICENSE_COMPLIANCE,
+ REPORT_TYPE_SECRET_DETECTION,
} from '~/vue_shared/security_reports/constants';
describe('Configuration Table Component', () => {
@@ -19,6 +15,8 @@ describe('Configuration Table Component', () => {
wrapper = extendedWrapper(mount(ConfigurationTable, {}));
};
+ const findHelpLinks = () => wrapper.findAll('[data-testid="help-link"]');
+
afterEach(() => {
wrapper.destroy();
});
@@ -27,22 +25,20 @@ describe('Configuration Table Component', () => {
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);
- }
+ describe.each(scanners.map((scanner, i) => [scanner, i]))('given scanner %s', (scanner, i) => {
+ it('should match strings', () => {
+ expect(wrapper.text()).toContain(scanner.name);
+ expect(wrapper.text()).toContain(scanner.description);
+ if (scanner.type === REPORT_TYPE_SAST) {
+ expect(wrapper.findByTestId(scanner.type).text()).toBe('Configure via Merge Request');
+ } else if (scanner.type !== REPORT_TYPE_SECRET_DETECTION) {
+ expect(wrapper.findByTestId(scanner.type).text()).toMatchInterpolatedText(UPGRADE_CTA);
+ }
+ });
+
+ it('should show expected help link', () => {
+ const helpLink = findHelpLinks().at(i);
+ expect(helpLink.attributes('href')).toBe(scanner.helpPath);
+ });
});
});
diff --git a/spec/frontend/security_configuration/upgrade_spec.js b/spec/frontend/security_configuration/upgrade_spec.js
index 0ab1108b265..1f0cc795fc5 100644
--- a/spec/frontend/security_configuration/upgrade_spec.js
+++ b/spec/frontend/security_configuration/upgrade_spec.js
@@ -1,28 +1,29 @@
import { mount } from '@vue/test-utils';
-import { UPGRADE_CTA } from '~/security_configuration/components/features_constants';
+import { UPGRADE_CTA } from '~/security_configuration/components/scanners_constants';
import Upgrade from '~/security_configuration/components/upgrade.vue';
+const TEST_URL = 'http://www.example.test';
let wrapper;
-const createComponent = () => {
- wrapper = mount(Upgrade, {});
+const createComponent = (componentData = {}) => {
+ wrapper = mount(Upgrade, componentData);
};
-beforeEach(() => {
- createComponent();
-});
-
afterEach(() => {
wrapper.destroy();
});
describe('Upgrade component', () => {
+ beforeEach(() => {
+ createComponent({ provide: { upgradePath: TEST_URL } });
+ });
+
it('renders correct text in link', () => {
expect(wrapper.text()).toMatchInterpolatedText(UPGRADE_CTA);
});
- it('renders link with correct attributes', () => {
+ it('renders link with correct default attributes', () => {
expect(wrapper.find('a').attributes()).toMatchObject({
- href: 'https://about.gitlab.com/pricing/',
+ href: TEST_URL,
target: '_blank',
});
});