1 import { expect } from 'expect'
4 DEFAULT_CIRCULAR_ARRAY_SIZE
5 } from '../../lib/circular-array.js'
6 import { updateMeasurementStatistics } from '../../lib/pools/utils.js'
8 describe('Pool utils test suite', () => {
9 it('Verify updateMeasurementStatistics() behavior', () => {
10 const measurementStatistics = {
11 history: new CircularArray()
13 updateMeasurementStatistics(
14 measurementStatistics,
15 { aggregate: true, average: false, median: false },
18 expect(measurementStatistics).toStrictEqual({
22 history: new CircularArray()
24 updateMeasurementStatistics(
25 measurementStatistics,
26 { aggregate: true, average: false, median: false },
29 expect(measurementStatistics).toStrictEqual({
33 history: new CircularArray()
35 updateMeasurementStatistics(
36 measurementStatistics,
37 { aggregate: true, average: true, median: false },
40 expect(measurementStatistics).toStrictEqual({
45 history: new CircularArray(DEFAULT_CIRCULAR_ARRAY_SIZE, 0.001)
47 updateMeasurementStatistics(
48 measurementStatistics,
49 { aggregate: true, average: true, median: false },
52 expect(measurementStatistics).toStrictEqual({
57 history: new CircularArray(DEFAULT_CIRCULAR_ARRAY_SIZE, 0.001, 0.003)
59 updateMeasurementStatistics(
60 measurementStatistics,
61 { aggregate: true, average: false, median: true },
64 expect(measurementStatistics).toStrictEqual({
69 history: new CircularArray(
70 DEFAULT_CIRCULAR_ARRAY_SIZE,
76 updateMeasurementStatistics(
77 measurementStatistics,
78 { aggregate: true, average: true, median: false },
81 expect(measurementStatistics).toStrictEqual({
86 history: new CircularArray(
87 DEFAULT_CIRCULAR_ARRAY_SIZE,