From 997bbcba251a487ec5533ea72dffe9ecc6dd7bb9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 19 Jul 2023 12:14:43 +0200 Subject: [PATCH] test: improve updateMeasurementStatistics() behavior test MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- tests/utils.test.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) 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) }) }) }) -- 2.34.1