const { expect } = require('expect')
const {
availableParallelism,
+ isAsyncFunction,
isKillBehavior,
isPlainObject,
median,
expect(isKillBehavior(KillBehaviors.SOFT)).toBe(false)
expect(isKillBehavior(KillBehaviors.HARD)).toBe(false)
expect(isKillBehavior(KillBehaviors.HARD, null)).toBe(false)
+ expect(isKillBehavior(KillBehaviors.HARD, undefined)).toBe(false)
expect(isKillBehavior(KillBehaviors.SOFT, 'unknown')).toBe(false)
})
+
+ it('Verify isAsyncFunction() behavior', () => {
+ expect(isAsyncFunction(null)).toBe(false)
+ expect(isAsyncFunction(undefined)).toBe(false)
+ expect(isAsyncFunction(true)).toBe(false)
+ expect(isAsyncFunction(false)).toBe(false)
+ expect(isAsyncFunction(0)).toBe(false)
+ expect(isAsyncFunction('')).toBe(false)
+ expect(isAsyncFunction([])).toBe(false)
+ expect(isAsyncFunction(new Date())).toBe(false)
+ expect(isAsyncFunction(new RegExp())).toBe(false)
+ expect(isAsyncFunction(new Error())).toBe(false)
+ expect(isAsyncFunction(new Map())).toBe(false)
+ expect(isAsyncFunction(new Set())).toBe(false)
+ expect(isAsyncFunction(new WeakMap())).toBe(false)
+ expect(isAsyncFunction(new WeakSet())).toBe(false)
+ expect(isAsyncFunction(new Int8Array())).toBe(false)
+ expect(isAsyncFunction(new Uint8Array())).toBe(false)
+ expect(isAsyncFunction(new Uint8ClampedArray())).toBe(false)
+ expect(isAsyncFunction(new Int16Array())).toBe(false)
+ expect(isAsyncFunction(new Uint16Array())).toBe(false)
+ expect(isAsyncFunction(new Int32Array())).toBe(false)
+ expect(isAsyncFunction(new Uint32Array())).toBe(false)
+ expect(isAsyncFunction(new Float32Array())).toBe(false)
+ expect(isAsyncFunction(new Float64Array())).toBe(false)
+ expect(isAsyncFunction(new BigInt64Array())).toBe(false)
+ expect(isAsyncFunction(new BigUint64Array())).toBe(false)
+ expect(isAsyncFunction(new Promise(() => {}))).toBe(false)
+ expect(isAsyncFunction(new WeakRef({}))).toBe(false)
+ expect(isAsyncFunction(new FinalizationRegistry(() => {}))).toBe(false)
+ expect(isAsyncFunction(new ArrayBuffer())).toBe(false)
+ expect(isAsyncFunction(new SharedArrayBuffer())).toBe(false)
+ expect(isAsyncFunction(new DataView(new ArrayBuffer()))).toBe(false)
+ expect(isAsyncFunction({})).toBe(false)
+ expect(isAsyncFunction({ a: 1 })).toBe(false)
+ expect(isAsyncFunction(() => {})).toBe(false)
+ expect(isAsyncFunction(function () {})).toBe(false)
+ expect(isAsyncFunction(function named () {})).toBe(false)
+ expect(isAsyncFunction(async () => {})).toBe(true)
+ expect(isAsyncFunction(async function () {})).toBe(true)
+ expect(isAsyncFunction(async function named () {})).toBe(true)
+ })
})