summaryrefslogtreecommitdiff
path: root/spec/frontend/monitoring/store/utils_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/monitoring/store/utils_spec.js')
-rw-r--r--spec/frontend/monitoring/store/utils_spec.js44
1 files changed, 2 insertions, 42 deletions
diff --git a/spec/frontend/monitoring/store/utils_spec.js b/spec/frontend/monitoring/store/utils_spec.js
index 98388ac19f8..d562aaaefe9 100644
--- a/spec/frontend/monitoring/store/utils_spec.js
+++ b/spec/frontend/monitoring/store/utils_spec.js
@@ -1,44 +1,4 @@
-import { groupQueriesByChartInfo, normalizeMetric, uniqMetricsId } from '~/monitoring/stores/utils';
-
-describe('groupQueriesByChartInfo', () => {
- let input;
- let output;
-
- it('groups metrics with the same chart title and y_axis label', () => {
- input = [
- { title: 'title', y_label: 'MB', queries: [{}] },
- { title: 'title', y_label: 'MB', queries: [{}] },
- { title: 'new title', y_label: 'MB', queries: [{}] },
- ];
-
- output = [
- {
- title: 'title',
- y_label: 'MB',
- queries: [{ metricId: null }, { metricId: null }],
- },
- { title: 'new title', y_label: 'MB', queries: [{ metricId: null }] },
- ];
-
- expect(groupQueriesByChartInfo(input)).toEqual(output);
- });
-
- // Functionality associated with the /additional_metrics endpoint
- it("associates a chart's stringified metric_id with the metric", () => {
- input = [{ id: 3, title: 'new title', y_label: 'MB', queries: [{}] }];
- output = [{ id: 3, title: 'new title', y_label: 'MB', queries: [{ metricId: '3' }] }];
-
- expect(groupQueriesByChartInfo(input)).toEqual(output);
- });
-
- // Functionality associated with the /metrics_dashboard endpoint
- it('aliases a stringified metrics_id on the metric to the metricId key', () => {
- input = [{ title: 'new title', y_label: 'MB', queries: [{ metric_id: 3 }] }];
- output = [{ title: 'new title', y_label: 'MB', queries: [{ metricId: '3', metric_id: 3 }] }];
-
- expect(groupQueriesByChartInfo(input)).toEqual(output);
- });
-});
+import { normalizeMetric, uniqMetricsId } from '~/monitoring/stores/utils';
describe('normalizeMetric', () => {
[
@@ -54,7 +14,7 @@ describe('normalizeMetric', () => {
},
].forEach(({ args, expected }) => {
it(`normalizes metric to "${expected}" with args=${JSON.stringify(args)}`, () => {
- expect(normalizeMetric(...args)).toEqual({ metric_id: expected });
+ expect(normalizeMetric(...args)).toEqual({ metric_id: expected, metricId: expected });
});
});
});