From: Jérôme Benoit Date: Wed, 19 Jul 2023 10:14:43 +0000 (+0200) Subject: test: improve updateMeasurementStatistics() behavior test X-Git-Tag: v2.6.18~5 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=997bbcba251a487ec5533ea72dffe9ecc6dd7bb9;p=poolifier.git test: improve updateMeasurementStatistics() behavior test Signed-off-by: Jérôme Benoit --- diff --git a/tests/utils.test.js b/tests/utils.test.js index 6518ca92..4053a146 100644 --- a/tests/utils.test.js +++ b/tests/utils.test.js @@ -1,4 +1,5 @@ const { expect } = require('expect') +const { CircularArray } = require('../lib/circular-array') const { availableParallelism, isAsyncFunction, @@ -128,17 +129,20 @@ describe('Utils test suite', () => { }) it('Verify updateMeasurementStatistics() behavior', () => { - const measurementStatistics = {} + const measurementStatistics = { + history: new CircularArray() + } updateMeasurementStatistics( measurementStatistics, { aggregate: true, average: false, median: false }, 0.01, 1 ) - expect(measurementStatistics).toEqual({ + expect(measurementStatistics).toStrictEqual({ aggregate: 0.01, maximum: 0.01, - minimum: 0.01 + minimum: 0.01, + history: expect.any(CircularArray) }) updateMeasurementStatistics( measurementStatistics, @@ -146,10 +150,11 @@ describe('Utils test suite', () => { 0.02, 2 ) - expect(measurementStatistics).toEqual({ + expect(measurementStatistics).toStrictEqual({ aggregate: 0.03, maximum: 0.02, - minimum: 0.01 + minimum: 0.01, + history: expect.any(CircularArray) }) updateMeasurementStatistics( measurementStatistics, @@ -157,11 +162,12 @@ describe('Utils test suite', () => { 0.001, 3 ) - expect(measurementStatistics).toEqual({ + expect(measurementStatistics).toStrictEqual({ aggregate: 0.031, maximum: 0.02, minimum: 0.001, - average: 0.010333333333333333 + average: 0.010333333333333333, + history: expect.any(CircularArray) }) }) })