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-25 09:09:02 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-25 09:09:02 +0300
commit807d57c18fdde0d9ba991a2b3b078a74a7472f30 (patch)
treed327848aee84f9af2fef556a0652b2f6e5da7aea /spec/frontend/vue_shared/components/alert_details_table_spec.js
parent3bd9ad5574f2ee81888dc13bc29e1d66dafaedba (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/vue_shared/components/alert_details_table_spec.js')
-rw-r--r--spec/frontend/vue_shared/components/alert_details_table_spec.js83
1 files changed, 50 insertions, 33 deletions
diff --git a/spec/frontend/vue_shared/components/alert_details_table_spec.js b/spec/frontend/vue_shared/components/alert_details_table_spec.js
index 49b82cb4d4e..03b04a92bdf 100644
--- a/spec/frontend/vue_shared/components/alert_details_table_spec.js
+++ b/spec/frontend/vue_shared/components/alert_details_table_spec.js
@@ -75,45 +75,62 @@ describe('AlertDetails', () => {
});
describe('with table data', () => {
- beforeEach(mountComponent);
-
- it('renders a table', () => {
- expect(findTableComponent().exists()).toBe(true);
- });
-
- it('renders a cell based on alert data', () => {
- expect(findTableComponent().text()).toContain('SyntaxError: Invalid or unexpected token');
- });
-
- it('should show allowed alert fields', () => {
- const fields = findTableKeys();
-
- expect(findTableField(fields, 'Iid').exists()).toBe(true);
- expect(findTableField(fields, 'Title').exists()).toBe(true);
- expect(findTableField(fields, 'Severity').exists()).toBe(true);
- expect(findTableField(fields, 'Status').exists()).toBe(true);
- expect(findTableField(fields, 'Hosts').exists()).toBe(true);
- expect(findTableField(fields, 'Environment').exists()).toBe(true);
+ describe('default', () => {
+ beforeEach(mountComponent);
+
+ it('renders a table', () => {
+ expect(findTableComponent().exists()).toBe(true);
+ });
+
+ it('renders a cell based on alert data', () => {
+ expect(findTableComponent().text()).toContain('SyntaxError: Invalid or unexpected token');
+ });
+
+ it('should show allowed alert fields', () => {
+ const fields = findTableKeys();
+ ['Iid', 'Title', 'Severity', 'Status', 'Hosts', 'Environment'].forEach((field) => {
+ expect(findTableField(fields, field).exists()).toBe(true);
+ });
+ });
+
+ it('should not show disallowed alert fields', () => {
+ const fields = findTableKeys();
+ ['Typename', 'Todos', 'Notes', 'Assignees'].forEach((field) => {
+ expect(findTableField(fields, field).exists()).toBe(false);
+ });
+ });
});
- it('should not show disallowed alert fields', () => {
- const fields = findTableKeys();
+ describe('environment', () => {
+ it('should display only the name for the environment', () => {
+ mountComponent();
+ expect(findTableFieldValueByKey('Environment').text()).toBe(environmentName);
+ });
- expect(findTableField(fields, 'Typename').exists()).toBe(false);
- expect(findTableField(fields, 'Todos').exists()).toBe(false);
- expect(findTableField(fields, 'Notes').exists()).toBe(false);
- expect(findTableField(fields, 'Assignees').exists()).toBe(false);
- });
+ it('should not display the environment row if there is not data', () => {
+ environmentData = { name: null, path: null };
+ mountComponent();
- it('should display only the name for the environment', () => {
- expect(findTableFieldValueByKey('Environment').text()).toBe(environmentName);
+ expect(findTableFieldValueByKey('Environment').text()).toBeFalsy();
+ });
});
- it('should not display the environment row if there is not data', () => {
- environmentData = { name: null, path: null };
- mountComponent();
-
- expect(findTableFieldValueByKey('Environment').text()).toBeFalsy();
+ describe('status', () => {
+ it('should show the translated status for the default statuses', () => {
+ mountComponent();
+ expect(findTableFieldValueByKey('Status').text()).toBe('Triggered');
+ });
+
+ it('should show the translated status for provided statuses', () => {
+ const translatedStatus = 'Test';
+ mountComponent({ statuses: { TRIGGERED: translatedStatus } });
+ expect(findTableFieldValueByKey('Status').text()).toBe(translatedStatus);
+ });
+
+ it('should show the provided status if value is not defined in statuses', () => {
+ mountComponent({ statuses: {} });
+ expect(findTableFieldValueByKey('Status').text()).toBe('TRIGGERED');
+ });
});
});
});