--- /dev/null
+const { expect } = require('expect')
+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)
+ })
+
+ it('Verify isPlainObject() behavior', () => {
+ expect(isPlainObject(null)).toBe(false)
+ expect(isPlainObject(undefined)).toBe(false)
+ expect(isPlainObject(true)).toBe(false)
+ expect(isPlainObject(false)).toBe(false)
+ expect(isPlainObject(0)).toBe(false)
+ expect(isPlainObject('')).toBe(false)
+ expect(isPlainObject([])).toBe(false)
+ expect(isPlainObject(() => {})).toBe(false)
+ expect(isPlainObject(new Date())).toBe(false)
+ expect(isPlainObject(new RegExp())).toBe(false)
+ expect(isPlainObject(new Error())).toBe(false)
+ expect(isPlainObject(new Map())).toBe(false)
+ expect(isPlainObject(new Set())).toBe(false)
+ expect(isPlainObject(new WeakMap())).toBe(false)
+ expect(isPlainObject(new WeakSet())).toBe(false)
+ expect(isPlainObject(new Int8Array())).toBe(false)
+ expect(isPlainObject(new Uint8Array())).toBe(false)
+ expect(isPlainObject(new Uint8ClampedArray())).toBe(false)
+ expect(isPlainObject(new Int16Array())).toBe(false)
+ expect(isPlainObject(new Uint16Array())).toBe(false)
+ expect(isPlainObject(new Int32Array())).toBe(false)
+ expect(isPlainObject(new Uint32Array())).toBe(false)
+ expect(isPlainObject(new Float32Array())).toBe(false)
+ expect(isPlainObject(new Float64Array())).toBe(false)
+ expect(isPlainObject(new BigInt64Array())).toBe(false)
+ expect(isPlainObject(new BigUint64Array())).toBe(false)
+ expect(isPlainObject(new Promise(() => {}))).toBe(false)
+ expect(isPlainObject(new WeakRef({}))).toBe(false)
+ expect(isPlainObject(new FinalizationRegistry(() => {}))).toBe(false)
+ expect(isPlainObject(new ArrayBuffer())).toBe(false)
+ expect(isPlainObject(new SharedArrayBuffer())).toBe(false)
+ expect(isPlainObject(new DataView(new ArrayBuffer()))).toBe(false)
+ expect(isPlainObject({})).toBe(true)
+ expect(isPlainObject({ a: 1 })).toBe(true)
+ })
+})