X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Futils.test.js;h=57bd2611ba9d517a0af1a458301b8fe090c633a9;hb=bb9423b78d11f9420b9b2a8cb865ea8c1315e642;hp=ef7688d6f337514bea5a405b18c608819b8d66ac;hpb=9fe8fd698590c2494dc6793cfd8c08026fe88a31;p=poolifier.git diff --git a/tests/utils.test.js b/tests/utils.test.js index ef7688d6..57bd2611 100644 --- a/tests/utils.test.js +++ b/tests/utils.test.js @@ -45,7 +45,7 @@ describe('Utils test suite', () => { expect(getWorkerId(clusterWorker)).toBe(clusterWorker.id) }) - it.skip('Verify sleep() behavior', async () => { + it('Verify sleep() behavior', async () => { const start = performance.now() await sleep(1000) const elapsed = performance.now() - start @@ -232,6 +232,41 @@ describe('Utils test suite', () => { average: 0.002, history: new CircularArray(DEFAULT_CIRCULAR_ARRAY_SIZE, 0.001, 0.003) }) + updateMeasurementStatistics( + measurementStatistics, + { aggregate: true, average: false, median: true }, + 0.006 + ) + expect(measurementStatistics).toStrictEqual({ + aggregate: 0.04, + maximum: 0.02, + minimum: 0.001, + median: 0.003, + history: new CircularArray( + DEFAULT_CIRCULAR_ARRAY_SIZE, + 0.001, + 0.003, + 0.006 + ) + }) + updateMeasurementStatistics( + measurementStatistics, + { aggregate: true, average: true, median: false }, + 0.01 + ) + expect(measurementStatistics).toStrictEqual({ + aggregate: 0.05, + maximum: 0.02, + minimum: 0.001, + average: 0.005, + history: new CircularArray( + DEFAULT_CIRCULAR_ARRAY_SIZE, + 0.001, + 0.003, + 0.006, + 0.01 + ) + }) }) it('Verify secureRandom() behavior', () => {