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:
Diffstat (limited to 'spec/frontend/ci/pipeline_details/test_reports')
-rw-r--r--spec/frontend/ci/pipeline_details/test_reports/stores/utils_spec.js28
-rw-r--r--spec/frontend/ci/pipeline_details/test_reports/test_reports_spec.js22
2 files changed, 50 insertions, 0 deletions
diff --git a/spec/frontend/ci/pipeline_details/test_reports/stores/utils_spec.js b/spec/frontend/ci/pipeline_details/test_reports/stores/utils_spec.js
index c0ffc2b34fb..ecc61ab43c0 100644
--- a/spec/frontend/ci/pipeline_details/test_reports/stores/utils_spec.js
+++ b/spec/frontend/ci/pipeline_details/test_reports/stores/utils_spec.js
@@ -36,5 +36,33 @@ describe('Test reports utils', () => {
expect(result).toBe('4.82s');
});
});
+
+ describe('when time is greater than a minute', () => {
+ it('should return time in minutes', () => {
+ const result = formattedTime(99);
+ expect(result).toBe('1m 39s');
+ });
+ });
+
+ describe('when time is greater than a hour', () => {
+ it('should return time in hours', () => {
+ const result = formattedTime(3606);
+ expect(result).toBe('1h 6s');
+ });
+ });
+
+ describe('when time is exact a hour', () => {
+ it('should return time as one hour', () => {
+ const result = formattedTime(3600);
+ expect(result).toBe('1h');
+ });
+ });
+
+ describe('when time is greater than a hour with some minutes', () => {
+ it('should return time in hours', () => {
+ const result = formattedTime(3662);
+ expect(result).toBe('1h 1m 2s');
+ });
+ });
});
});
diff --git a/spec/frontend/ci/pipeline_details/test_reports/test_reports_spec.js b/spec/frontend/ci/pipeline_details/test_reports/test_reports_spec.js
index 8ff060026da..d318aa36bcf 100644
--- a/spec/frontend/ci/pipeline_details/test_reports/test_reports_spec.js
+++ b/spec/frontend/ci/pipeline_details/test_reports/test_reports_spec.js
@@ -5,6 +5,7 @@ import Vue from 'vue';
import Vuex from 'vuex';
import testReports from 'test_fixtures/pipelines/test_report.json';
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
+import { getParameterValues } from '~/lib/utils/url_utility';
import EmptyState from '~/ci/pipeline_details/test_reports/empty_state.vue';
import TestReports from '~/ci/pipeline_details/test_reports/test_reports.vue';
import TestSummary from '~/ci/pipeline_details/test_reports/test_summary.vue';
@@ -13,6 +14,11 @@ import * as getters from '~/ci/pipeline_details/stores/test_reports/getters';
Vue.use(Vuex);
+jest.mock('~/lib/utils/url_utility', () => ({
+ ...jest.requireActual('~/lib/utils/url_utility'),
+ getParameterValues: jest.fn().mockReturnValue([]),
+}));
+
describe('Test reports app', () => {
let wrapper;
let store;
@@ -100,6 +106,22 @@ describe('Test reports app', () => {
});
});
+ describe('when a job name is provided as a query parameter', () => {
+ beforeEach(() => {
+ getParameterValues.mockReturnValue(['javascript']);
+ createComponent();
+ });
+
+ it('shows tests details', () => {
+ expect(testsDetail().exists()).toBe(true);
+ });
+
+ it('should call setSelectedSuiteIndex and fetchTestSuite', () => {
+ expect(actionSpies.setSelectedSuiteIndex).toHaveBeenCalled();
+ expect(actionSpies.fetchTestSuite).toHaveBeenCalled();
+ });
+ });
+
describe('when a suite is clicked', () => {
beforeEach(() => {
createComponent({ state: { hasFullReport: true } });