X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fpools%2Futils.test.mjs;h=f29515d516bf4fc8250083afda6795af6aa3ac0f;hb=b412645758eeef9795de69878b1f07ae787906e8;hp=3d9634ff50256ea0cac40b80351ba688a5c66a64;hpb=f12182ad6dc553c7a5dfeee01bcde65c0177f671;p=poolifier.git diff --git a/tests/pools/utils.test.mjs b/tests/pools/utils.test.mjs index 3d9634ff..f29515d5 100644 --- a/tests/pools/utils.test.mjs +++ b/tests/pools/utils.test.mjs @@ -36,79 +36,72 @@ describe('Pool utils test suite', () => { }) it('Verify updateMeasurementStatistics() behavior', () => { - const circularBuffer = new CircularBuffer(MeasurementHistorySize) const measurementStatistics = { - history: circularBuffer + history: new CircularBuffer(MeasurementHistorySize) } updateMeasurementStatistics( measurementStatistics, { aggregate: true, average: false, median: false }, 0.01 ) - expect(measurementStatistics).toStrictEqual({ + expect(measurementStatistics).toMatchObject({ aggregate: 0.01, maximum: 0.01, - minimum: 0.01, - history: circularBuffer + minimum: 0.01 }) updateMeasurementStatistics( measurementStatistics, { aggregate: true, average: false, median: false }, 0.02 ) - expect(measurementStatistics).toStrictEqual({ + expect(measurementStatistics).toMatchObject({ aggregate: 0.03, maximum: 0.02, - minimum: 0.01, - history: circularBuffer + minimum: 0.01 }) updateMeasurementStatistics( measurementStatistics, { aggregate: true, average: true, median: false }, 0.001 ) - expect(measurementStatistics).toStrictEqual({ + expect(measurementStatistics).toMatchObject({ aggregate: 0.031, maximum: 0.02, minimum: 0.001, - average: 0.001, - history: circularBuffer + average: 0.0010000000474974513 }) updateMeasurementStatistics( measurementStatistics, { aggregate: true, average: true, median: false }, 0.003 ) - expect(measurementStatistics).toStrictEqual({ + expect(measurementStatistics).toMatchObject({ aggregate: 0.034, maximum: 0.02, minimum: 0.001, - average: 0.002, - history: circularBuffer + average: 0.0020000000367872417 }) updateMeasurementStatistics( measurementStatistics, { aggregate: true, average: false, median: true }, 0.006 ) - expect(measurementStatistics).toStrictEqual({ + expect(measurementStatistics).toMatchObject({ aggregate: 0.04, maximum: 0.02, minimum: 0.001, - median: 0.003, - history: circularBuffer + median: 0.003000000026077032 }) updateMeasurementStatistics( measurementStatistics, { aggregate: true, average: true, median: false }, 0.01 ) - expect(measurementStatistics).toStrictEqual({ + expect(measurementStatistics).toMatchObject({ aggregate: 0.05, maximum: 0.02, minimum: 0.001, - average: 0.005, - history: circularBuffer + average: 0.004999999975552782 }) })