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>2023-04-28 03:12:20 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-04-28 03:12:20 +0300
commite74c47fb1bd1c137145e19143b0f77cf420990f4 (patch)
tree1ea75375e2d46a0fcc107c336759454c24a332e4 /spec/frontend/incidents_settings
parente49c47d3bc5603e8e9d6ad40fc7fccae9f885843 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/incidents_settings')
-rw-r--r--spec/frontend/incidents_settings/components/__snapshots__/incidents_settings_tabs_spec.js.snap59
-rw-r--r--spec/frontend/incidents_settings/components/incidents_settings_tabs_spec.js30
2 files changed, 11 insertions, 78 deletions
diff --git a/spec/frontend/incidents_settings/components/__snapshots__/incidents_settings_tabs_spec.js.snap b/spec/frontend/incidents_settings/components/__snapshots__/incidents_settings_tabs_spec.js.snap
deleted file mode 100644
index 0f042dfaa4c..00000000000
--- a/spec/frontend/incidents_settings/components/__snapshots__/incidents_settings_tabs_spec.js.snap
+++ /dev/null
@@ -1,59 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`IncidentsSettingTabs should render the component 1`] = `
-<section
- class="settings no-animate"
- data-qa-selector="incidents_settings_content"
- id="incident-management-settings"
->
- <div
- class="settings-header"
- >
- <h4
- class="settings-title js-settings-toggle js-settings-toggle-trigger-only"
- >
-
- Incidents
-
- </h4>
-
- <gl-button-stub
- buttontextclasses=""
- category="primary"
- class="js-settings-toggle"
- icon=""
- size="medium"
- variant="default"
- >
- Expand
- </gl-button-stub>
-
- <p>
-
- Fine-tune incident settings and set up integrations with external tools to help better manage incidents.
-
- </p>
- </div>
-
- <div
- class="settings-content"
- >
- <gl-tabs-stub
- queryparamname="tab"
- value="0"
- >
- <!---->
-
- <gl-tab-stub
- title="PagerDuty integration"
- titlelinkclass=""
- >
- <pagerdutysettingsform-stub
- class="gl-pt-3"
- data-testid="PagerDutySettingsForm-tab"
- />
- </gl-tab-stub>
- </gl-tabs-stub>
- </div>
-</section>
-`;
diff --git a/spec/frontend/incidents_settings/components/incidents_settings_tabs_spec.js b/spec/frontend/incidents_settings/components/incidents_settings_tabs_spec.js
index 394d1f12bcb..850fd9f0fc9 100644
--- a/spec/frontend/incidents_settings/components/incidents_settings_tabs_spec.js
+++ b/spec/frontend/incidents_settings/components/incidents_settings_tabs_spec.js
@@ -1,12 +1,13 @@
import { GlTab } from '@gitlab/ui';
-import { shallowMount } from '@vue/test-utils';
+import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import IncidentsSettingTabs from '~/incidents_settings/components/incidents_settings_tabs.vue';
+import { INTEGRATION_TABS_CONFIG } from '~/incidents_settings/constants';
describe('IncidentsSettingTabs', () => {
let wrapper;
beforeEach(() => {
- wrapper = shallowMount(IncidentsSettingTabs, {
+ wrapper = shallowMountExtended(IncidentsSettingTabs, {
provide: {
service: {},
serviceLevelAgreementSettings: {},
@@ -14,16 +15,12 @@ describe('IncidentsSettingTabs', () => {
});
});
- afterEach(() => {
- if (wrapper) {
- wrapper.destroy();
- }
- });
-
const findToggleButton = () => wrapper.findComponent({ ref: 'toggleBtn' });
const findSectionHeader = () => wrapper.findComponent({ ref: 'sectionHeader' });
-
const findIntegrationTabs = () => wrapper.findAllComponents(GlTab);
+ const findIntegrationTabAt = (index) => findIntegrationTabs().at(index);
+ const findTabComponent = (tab) => wrapper.findByTestId(`${tab.component}-tab`);
+
it('renders header text', () => {
expect(findSectionHeader().text()).toBe('Incidents');
});
@@ -34,18 +31,13 @@ describe('IncidentsSettingTabs', () => {
});
});
- it('should render the component', () => {
- expect(wrapper.element).toMatchSnapshot();
- });
-
it('should render the tab for each active integration', () => {
- const activeTabs = wrapper.vm.$options.tabs.filter((tab) => tab.active);
- expect(findIntegrationTabs().length).toBe(activeTabs.length);
+ const activeTabs = INTEGRATION_TABS_CONFIG.filter((tab) => tab.active);
+ expect(findIntegrationTabs()).toHaveLength(activeTabs.length);
+
activeTabs.forEach((tab, index) => {
- expect(findIntegrationTabs().at(index).attributes('title')).toBe(tab.title);
- expect(
- findIntegrationTabs().at(index).find(`[data-testid="${tab.component}-tab"]`).exists(),
- ).toBe(true);
+ expect(findIntegrationTabAt(index).attributes('title')).toBe(tab.title);
+ expect(findTabComponent(tab).exists()).toBe(true);
});
});
});