Skip to content
This repository was archived by the owner on Mar 4, 2022. It is now read-only.

Commit 925194c

Browse files
committed
extract metrics retention test
1 parent 1c12afe commit 925194c

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

test/lib/providers/metrics-provider.spec.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,9 @@ describe("MetricsProvider", function () {
130130
});
131131

132132
describe("_onMetrics", function () {
133-
it("retains metrics received, while aggregating them into time buckets", function () {
134-
// Fill in a single event so all future events result in a average calculation
135-
var mockMetrics = fill(1, 1);
136-
137-
// Add an event at the 2nd time slot of the largest bucket
138-
// This will cause an average calculation for all buckets
139-
var maxZoomLevel = +AGGREGATE_TIME_LEVELS[AGGREGATE_TIME_LEVELS.length - 1];
140-
mockMetrics = mockMetrics.concat(fill(1, maxZoomLevel));
133+
it("retains metrics received", function () {
134+
// create some mock data
135+
var mockMetrics = fill(10, 500);
141136

142137
// the number of data points retained must match the number provided
143138
expect(metricsProvider)
@@ -166,6 +161,16 @@ describe("MetricsProvider", function () {
166161
.with.property("valueB")
167162
.that.equals(mockMetrics[index].metricB.valueB);
168163
});
164+
});
165+
166+
it("aggregates metrics into time buckets", function () {
167+
// Fill in a single event so all future events result in a average calculation
168+
var mockMetrics = fill(1, 1);
169+
170+
// Add an event at the 2nd time slot of the largest bucket
171+
// This will cause an average calculation for all buckets
172+
var maxZoomLevel = +AGGREGATE_TIME_LEVELS[AGGREGATE_TIME_LEVELS.length - 1];
173+
mockMetrics = mockMetrics.concat(fill(1, maxZoomLevel));
169174

170175
// The 2nd event filled all average buckets with the first event
171176
// Since there is only 1 event the average is the same values

0 commit comments

Comments
 (0)