docs: refine worker choice strategies documentation
[poolifier.git] / tests / utils.test.js
index 97b5e8a985bd9569efe405c813740b4551c4c607..76abf04645ef4fa6e70b7e88e97ea25a611dde89 100644 (file)
@@ -11,6 +11,7 @@ const {
   isPlainObject,
   median,
   round,
+  secureRandom,
   updateMeasurementStatistics
 } = require('../lib/utils')
 const { KillBehaviors } = require('../lib/worker/worker-options')
@@ -196,4 +197,11 @@ describe('Utils test suite', () => {
       history: new CircularArray(DEFAULT_CIRCULAR_ARRAY_SIZE, 0.001, 0.003)
     })
   })
+
+  it('Verify secureRandom() behavior', () => {
+    const randomNumber = secureRandom()
+    expect(typeof randomNumber === 'number').toBe(true)
+    expect(randomNumber).toBeGreaterThanOrEqual(0)
+    expect(randomNumber).toBeLessThan(1)
+  })
 })