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>2022-06-14 18:08:43 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-06-14 18:08:43 +0300
commit9b8269e5708ba1c38610189f84cf7224b640c0ed (patch)
tree70916a0afcfd90ed5425a80bab7f6bedca13d622 /spec/frontend
parent7a124e225ea58c2a432dd29f82ba682963886383 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
-rw-r--r--spec/frontend/ide/components/commit_sidebar/editor_header_spec.js2
-rw-r--r--spec/frontend/security_configuration/components/app_spec.js94
-rw-r--r--spec/frontend/security_configuration/mock_data.js9
-rw-r--r--spec/frontend/sidebar/components/attention_requested_toggle_spec.js12
-rw-r--r--spec/frontend/vue_mr_widget/components/mr_collapsible_extension_spec.js8
5 files changed, 42 insertions, 83 deletions
diff --git a/spec/frontend/ide/components/commit_sidebar/editor_header_spec.js b/spec/frontend/ide/components/commit_sidebar/editor_header_spec.js
index 6e4c66cb780..d77e8e3d04c 100644
--- a/spec/frontend/ide/components/commit_sidebar/editor_header_spec.js
+++ b/spec/frontend/ide/components/commit_sidebar/editor_header_spec.js
@@ -68,7 +68,7 @@ describe('IDE commit editor header', () => {
it('calls discardFileChanges if dialog result is confirmed', () => {
expect(store.dispatch).not.toHaveBeenCalled();
- findDiscardModal().vm.$emit('ok');
+ findDiscardModal().vm.$emit('primary');
expect(store.dispatch).toHaveBeenCalledWith('discardFileChanges', TEST_FILE_PATH);
});
diff --git a/spec/frontend/security_configuration/components/app_spec.js b/spec/frontend/security_configuration/components/app_spec.js
index d7d46d0d415..de91e51924d 100644
--- a/spec/frontend/security_configuration/components/app_spec.js
+++ b/spec/frontend/security_configuration/components/app_spec.js
@@ -2,7 +2,6 @@ import Vue, { nextTick } from 'vue';
import VueApollo from 'vue-apollo';
import { GlTab, GlTabs, GlLink } from '@gitlab/ui';
import { mount } from '@vue/test-utils';
-
import { useLocalStorageSpy } from 'helpers/local_storage_helper';
import { makeMockUserCalloutDismisser } from 'helpers/mock_user_callout_dismisser';
import stubChildren from 'helpers/stub_children';
@@ -20,22 +19,14 @@ import {
LICENSE_COMPLIANCE_DESCRIPTION,
LICENSE_COMPLIANCE_HELP_PATH,
AUTO_DEVOPS_ENABLED_ALERT_DISMISSED_STORAGE_KEY,
- LICENSE_ULTIMATE,
- LICENSE_PREMIUM,
- LICENSE_FREE,
} from '~/security_configuration/components/constants';
import FeatureCard from '~/security_configuration/components/feature_card.vue';
import TrainingProviderList from '~/security_configuration/components/training_provider_list.vue';
-import createMockApollo from 'helpers/mock_apollo_helper';
-import currentLicenseQuery from '~/security_configuration/graphql/current_license.query.graphql';
-import waitForPromises from 'helpers/wait_for_promises';
-
import UpgradeBanner from '~/security_configuration/components/upgrade_banner.vue';
import {
REPORT_TYPE_LICENSE_COMPLIANCE,
REPORT_TYPE_SAST,
} from '~/vue_shared/security_reports/constants';
-import { getCurrentLicensePlanResponse } from '../mock_data';
const upgradePath = '/upgrade';
const autoDevopsHelpPagePath = '/autoDevopsHelpPagePath';
@@ -50,31 +41,16 @@ Vue.use(VueApollo);
describe('App component', () => {
let wrapper;
let userCalloutDismissSpy;
- let mockApollo;
- const createComponent = ({
- shouldShowCallout = true,
- licenseQueryResponse = LICENSE_ULTIMATE,
- ...propsData
- }) => {
+ const createComponent = ({ shouldShowCallout = true, ...propsData }) => {
userCalloutDismissSpy = jest.fn();
- mockApollo = createMockApollo([
- [
- currentLicenseQuery,
- jest
- .fn()
- .mockResolvedValue(
- licenseQueryResponse instanceof Error
- ? licenseQueryResponse
- : getCurrentLicensePlanResponse(licenseQueryResponse),
- ),
- ],
- ]);
-
wrapper = extendedWrapper(
mount(SecurityConfigurationApp, {
- propsData,
+ propsData: {
+ securityTrainingEnabled: true,
+ ...propsData,
+ },
provide: {
upgradePath,
autoDevopsHelpPagePath,
@@ -82,7 +58,6 @@ describe('App component', () => {
projectFullPath,
vulnerabilityTrainingDocsPath,
},
- apolloProvider: mockApollo,
stubs: {
...stubChildren(SecurityConfigurationApp),
GlLink: false,
@@ -157,7 +132,6 @@ describe('App component', () => {
afterEach(() => {
wrapper.destroy();
- mockApollo = null;
});
describe('basic structure', () => {
@@ -166,7 +140,6 @@ describe('App component', () => {
augmentedSecurityFeatures: securityFeaturesMock,
augmentedComplianceFeatures: complianceFeaturesMock,
});
- await waitForPromises();
});
it('renders main-heading with correct text', () => {
@@ -469,47 +442,42 @@ describe('App component', () => {
});
describe('Vulnerability management', () => {
- beforeEach(async () => {
+ it('does not show tab if security training is disabled', () => {
createComponent({
augmentedSecurityFeatures: securityFeaturesMock,
augmentedComplianceFeatures: complianceFeaturesMock,
+ securityTrainingEnabled: false,
});
- await waitForPromises();
- });
- it('renders TrainingProviderList component', () => {
- expect(findTrainingProviderList().exists()).toBe(true);
+ expect(findVulnerabilityManagementTab().exists()).toBe(false);
});
- it('renders security training description', () => {
- expect(findVulnerabilityManagementTab().text()).toContain(i18n.securityTrainingDescription);
- });
-
- it('renders link to help docs', () => {
- const trainingLink = findVulnerabilityManagementTab().findComponent(GlLink);
-
- expect(trainingLink.text()).toBe('Learn more about vulnerability training');
- expect(trainingLink.attributes('href')).toBe(vulnerabilityTrainingDocsPath);
- });
-
- it.each`
- licenseQueryResponse | display
- ${LICENSE_ULTIMATE} | ${true}
- ${LICENSE_PREMIUM} | ${false}
- ${LICENSE_FREE} | ${false}
- ${null} | ${true}
- ${new Error()} | ${true}
- `(
- 'displays $display for license $licenseQueryResponse',
- async ({ licenseQueryResponse, display }) => {
+ describe('security training enabled', () => {
+ beforeEach(async () => {
createComponent({
- licenseQueryResponse,
augmentedSecurityFeatures: securityFeaturesMock,
augmentedComplianceFeatures: complianceFeaturesMock,
});
- await waitForPromises();
- expect(findVulnerabilityManagementTab().exists()).toBe(display);
- },
- );
+ });
+
+ it('shows the tab if security training is enabled', () => {
+ expect(findVulnerabilityManagementTab().exists()).toBe(true);
+ });
+
+ it('renders TrainingProviderList component', () => {
+ expect(findTrainingProviderList().exists()).toBe(true);
+ });
+
+ it('renders security training description', () => {
+ expect(findVulnerabilityManagementTab().text()).toContain(i18n.securityTrainingDescription);
+ });
+
+ it('renders link to help docs', () => {
+ const trainingLink = findVulnerabilityManagementTab().findComponent(GlLink);
+
+ expect(trainingLink.text()).toBe('Learn more about vulnerability training');
+ expect(trainingLink.attributes('href')).toBe(vulnerabilityTrainingDocsPath);
+ });
+ });
});
});
diff --git a/spec/frontend/security_configuration/mock_data.js b/spec/frontend/security_configuration/mock_data.js
index 94a36472a1d..18a480bf082 100644
--- a/spec/frontend/security_configuration/mock_data.js
+++ b/spec/frontend/security_configuration/mock_data.js
@@ -111,12 +111,3 @@ export const tempProviderLogos = {
svg: `<svg>${[testProviderName[1]]}</svg>`,
},
};
-
-export const getCurrentLicensePlanResponse = (plan) => ({
- data: {
- currentLicense: {
- id: 'gid://gitlab/License/1',
- plan,
- },
- },
-});
diff --git a/spec/frontend/sidebar/components/attention_requested_toggle_spec.js b/spec/frontend/sidebar/components/attention_requested_toggle_spec.js
index 959fa799eb7..58fa878a189 100644
--- a/spec/frontend/sidebar/components/attention_requested_toggle_spec.js
+++ b/spec/frontend/sidebar/components/attention_requested_toggle_spec.js
@@ -41,18 +41,18 @@ describe('Attention require toggle', () => {
);
it.each`
- attentionRequested | variant
- ${true} | ${'warning'}
- ${false} | ${'default'}
+ attentionRequested | selected
+ ${true} | ${true}
+ ${false} | ${false}
`(
- 'renders button with variant $variant when attention_requested is $attentionRequested',
- ({ attentionRequested, variant }) => {
+ 'renders button with as selected when $selected when attention_requested is $attentionRequested',
+ ({ attentionRequested, selected }) => {
factory({
type: 'reviewer',
user: { attention_requested: attentionRequested, can_update_merge_request: true },
});
- expect(findToggle().props('variant')).toBe(variant);
+ expect(findToggle().props('selected')).toBe(selected);
},
);
diff --git a/spec/frontend/vue_mr_widget/components/mr_collapsible_extension_spec.js b/spec/frontend/vue_mr_widget/components/mr_collapsible_extension_spec.js
index 82526af7afa..01fbcb2154f 100644
--- a/spec/frontend/vue_mr_widget/components/mr_collapsible_extension_spec.js
+++ b/spec/frontend/vue_mr_widget/components/mr_collapsible_extension_spec.js
@@ -42,8 +42,8 @@ describe('Merge Request Collapsible Extension', () => {
expect(wrapper.find('[data-testid="collapsed-header"]').text()).toBe('hello there');
});
- it('renders angle-right icon', () => {
- expect(findIcon().props('name')).toBe('angle-right');
+ it('renders chevron-lg-right icon', () => {
+ expect(findIcon().props('name')).toBe('chevron-lg-right');
});
describe('onClick', () => {
@@ -60,8 +60,8 @@ describe('Merge Request Collapsible Extension', () => {
expect(findTitle().text()).toBe('Collapse');
});
- it('renders angle-down icon', () => {
- expect(findIcon().props('name')).toBe('angle-down');
+ it('renders chevron-lg-down icon', () => {
+ expect(findIcon().props('name')).toBe('chevron-lg-down');
});
});
});