summaryrefslogtreecommitdiff
path: root/spec/frontend/alert_management/components/alert_details_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/alert_management/components/alert_details_spec.js')
-rw-r--r--spec/frontend/alert_management/components/alert_details_spec.js45
1 files changed, 15 insertions, 30 deletions
diff --git a/spec/frontend/alert_management/components/alert_details_spec.js b/spec/frontend/alert_management/components/alert_details_spec.js
index f3ebdfc5cc2..e2d913398f9 100644
--- a/spec/frontend/alert_management/components/alert_details_spec.js
+++ b/spec/frontend/alert_management/components/alert_details_spec.js
@@ -20,11 +20,7 @@ const environmentName = 'Production';
const environmentPath = '/fake/path';
describe('AlertDetails', () => {
- let environmentData = {
- name: environmentName,
- path: environmentPath,
- };
- let glFeatures = { exposeEnvironmentPathInAlertDetails: false };
+ let environmentData = { name: environmentName, path: environmentPath };
let mock;
let wrapper;
const projectPath = 'root/alerts';
@@ -40,7 +36,6 @@ describe('AlertDetails', () => {
projectPath,
projectIssuesPath,
projectId,
- glFeatures,
},
data() {
return {
@@ -159,33 +154,21 @@ describe('AlertDetails', () => {
});
describe('environment fields', () => {
- describe('when exposeEnvironmentPathInAlertDetails is disabled', () => {
- beforeEach(mountComponent);
+ it('should show the environment name with a link to the path', () => {
+ mountComponent();
+ const path = findEnvironmentPath();
- it('should not show the environment', () => {
- expect(findEnvironmentName().exists()).toBe(false);
- expect(findEnvironmentPath().exists()).toBe(false);
- });
+ expect(findEnvironmentName().exists()).toBe(false);
+ expect(path.text()).toBe(environmentName);
+ expect(path.attributes('href')).toBe(environmentPath);
});
- describe('when exposeEnvironmentPathInAlertDetails is enabled', () => {
- beforeEach(() => {
- glFeatures = { exposeEnvironmentPathInAlertDetails: true };
- mountComponent();
- });
-
- it('should show the environment name with link to path', () => {
- expect(findEnvironmentName().exists()).toBe(false);
- expect(findEnvironmentPath().text()).toBe(environmentName);
- expect(findEnvironmentPath().attributes('href')).toBe(environmentPath);
- });
+ it('should only show the environment name if the path is not provided', () => {
+ environmentData = { name: environmentName, path: null };
+ mountComponent();
- it('should only show the environment name if the path is not provided', () => {
- environmentData = { name: environmentName, path: null };
- mountComponent();
- expect(findEnvironmentPath().exists()).toBe(false);
- expect(findEnvironmentName().text()).toBe(environmentName);
- });
+ expect(findEnvironmentPath().exists()).toBe(false);
+ expect(findEnvironmentName().text()).toBe(environmentName);
});
});
@@ -195,6 +178,7 @@ describe('AlertDetails', () => {
mountComponent({
data: { alert: { ...mockAlert, issueIid }, sidebarStatus: false },
});
+
expect(findViewIncidentBtn().exists()).toBe(true);
expect(findViewIncidentBtn().attributes('href')).toBe(
joinPaths(projectIssuesPath, issueIid),
@@ -220,8 +204,8 @@ describe('AlertDetails', () => {
jest
.spyOn(wrapper.vm.$apollo, 'mutate')
.mockResolvedValue({ data: { createAlertIssue: { issue: { iid: issueIid } } } });
-
findCreateIncidentBtn().trigger('click');
+
expect(wrapper.vm.$apollo.mutate).toHaveBeenCalledWith({
mutation: createIssueMutation,
variables: {
@@ -251,6 +235,7 @@ describe('AlertDetails', () => {
beforeEach(() => {
mountComponent({ data: { alert: mockAlert } });
});
+
it('should display a table of raw alert details data', () => {
expect(findDetailsTable().exists()).toBe(true);
});