refactor: convert helper to arrow function
[poolifier.git] / tests / utils.test.js
index 7d4040ce324ec67a8668d68e38ab1a70eb45e165..f3278e4780b064ee25b6fcf7d900559b96fb23c7 100644 (file)
@@ -3,8 +3,10 @@ const { isPlainObject, median } = require('../lib/utils')
 
 describe('Utils test suite', () => {
   it('Verify median computation', () => {
-    const array = [0.25, 4.75, 3.05, 6.04, 1.01, 2.02, 5.03]
-    expect(median(array)).toBe(2.535)
+    expect(median([])).toBe(0)
+    expect(median([0.08])).toBe(0.08)
+    expect(median([0.25, 4.75, 3.05, 6.04, 1.01, 2.02, 5.03])).toBe(3.05)
+    expect(median([0.25, 4.75, 3.05, 6.04, 1.01, 2.02])).toBe(2.535)
   })
 
   it('Verify isPlainObject() behavior', () => {