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>2019-10-04 00:07:29 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-04 00:07:29 +0300
commit1da3754b25657f49afdcb0b942506d365b1ee89d (patch)
tree9f4bfa94fdd1762ef99e6a61bf180ac8cd7b5616 /spec/javascripts/monitoring
parent25521def84a6987fe9d4265b560e930bfb32c195 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/javascripts/monitoring')
-rw-r--r--spec/javascripts/monitoring/components/dashboard_spec.js4
-rw-r--r--spec/javascripts/monitoring/utils_spec.js53
2 files changed, 53 insertions, 4 deletions
diff --git a/spec/javascripts/monitoring/components/dashboard_spec.js b/spec/javascripts/monitoring/components/dashboard_spec.js
index 87aa4ba500d..ab3ab477708 100644
--- a/spec/javascripts/monitoring/components/dashboard_spec.js
+++ b/spec/javascripts/monitoring/components/dashboard_spec.js
@@ -333,8 +333,8 @@ describe('Dashboard', () => {
});
it('shows a specific time window selected from the url params', done => {
- const start = 1564439536;
- const end = 1564441336;
+ const start = '2019-10-01T18:27:47.000Z';
+ const end = '2019-10-01T18:57:47.000Z';
spyOnDependency(Dashboard, 'getTimeDiff').and.returnValue({
start,
end,
diff --git a/spec/javascripts/monitoring/utils_spec.js b/spec/javascripts/monitoring/utils_spec.js
index e22e8cdc03d..7030156931f 100644
--- a/spec/javascripts/monitoring/utils_spec.js
+++ b/spec/javascripts/monitoring/utils_spec.js
@@ -1,5 +1,5 @@
-import { getTimeDiff, graphDataValidatorForValues } from '~/monitoring/utils';
-import { timeWindows } from '~/monitoring/constants';
+import { getTimeDiff, getTimeWindow, graphDataValidatorForValues } from '~/monitoring/utils';
+import { timeWindows, timeWindowsKeyNames } from '~/monitoring/constants';
import { graphDataPrometheusQuery, graphDataPrometheusQueryRange } from './mock_data';
describe('getTimeDiff', () => {
@@ -39,6 +39,55 @@ describe('getTimeDiff', () => {
});
});
+describe('getTimeWindow', () => {
+ [
+ {
+ args: [
+ {
+ start: '2019-10-01T18:27:47.000Z',
+ end: '2019-10-01T21:27:47.000Z',
+ },
+ ],
+ expected: timeWindowsKeyNames.threeHours,
+ },
+ {
+ args: [
+ {
+ start: '2019-10-01T28:27:47.000Z',
+ end: '2019-10-01T21:27:47.000Z',
+ },
+ ],
+ expected: timeWindowsKeyNames.eightHours,
+ },
+ {
+ args: [
+ {
+ start: '',
+ end: '',
+ },
+ ],
+ expected: timeWindowsKeyNames.eightHours,
+ },
+ {
+ args: [
+ {
+ start: null,
+ end: null,
+ },
+ ],
+ expected: timeWindowsKeyNames.eightHours,
+ },
+ {
+ args: [{}],
+ expected: timeWindowsKeyNames.eightHours,
+ },
+ ].forEach(({ args, expected }) => {
+ it(`returns "${expected}" with args=${JSON.stringify(args)}`, () => {
+ expect(getTimeWindow(...args)).toEqual(expected);
+ });
+ });
+});
+
describe('graphDataValidatorForValues', () => {
/*
* When dealing with a metric using the query format, e.g.