repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
build(ci): silence linter
[poolifier.git]
/
tests
/
utils.test.mjs
diff --git
a/tests/utils.test.mjs
b/tests/utils.test.mjs
index cd8deb8cd8e588ad7b3dc51901576270357ea901..25b4e5ae0cfd21cc84e5fb523748e84e44a95e0b 100644
(file)
--- a/
tests/utils.test.mjs
+++ b/
tests/utils.test.mjs
@@
-1,11
+1,14
@@
-import os from 'node:os'
import { randomInt } from 'node:crypto'
import { randomInt } from 'node:crypto'
+import os from 'node:os'
+
import { expect } from 'expect'
import { expect } from 'expect'
+
+import { KillBehaviors } from '../lib/index.cjs'
import {
import {
- DEFAULT_TASK_NAME,
- EMPTY_FUNCTION,
availableParallelism,
average,
availableParallelism,
average,
+ DEFAULT_TASK_NAME,
+ EMPTY_FUNCTION,
exponentialDelay,
isAsyncFunction,
isKillBehavior,
exponentialDelay,
isAsyncFunction,
isKillBehavior,
@@
-16,9
+19,8
@@
import {
// once,
round,
secureRandom,
// once,
round,
secureRandom,
- sleep
+ sleep
,
} from '../lib/utils.cjs'
} from '../lib/utils.cjs'
-import { KillBehaviors } from '../lib/index.cjs'
describe('Utils test suite', () => {
it('Verify DEFAULT_TASK_NAME value', () => {
describe('Utils test suite', () => {
it('Verify DEFAULT_TASK_NAME value', () => {
@@
-35,6
+37,7
@@
describe('Utils test suite', () => {
expect(Number.isSafeInteger(parallelism)).toBe(true)
let expectedParallelism = 1
try {
expect(Number.isSafeInteger(parallelism)).toBe(true)
let expectedParallelism = 1
try {
+ // eslint-disable-next-line n/no-unsupported-features/node-builtins
expectedParallelism = os.availableParallelism()
} catch {
expectedParallelism = os.cpus().length
expectedParallelism = os.availableParallelism()
} catch {
expectedParallelism = os.cpus().length
@@
-147,8
+150,7
@@
describe('Utils test suite', () => {
expect(isAsyncFunction('')).toBe(false)
expect(isAsyncFunction([])).toBe(false)
expect(isAsyncFunction(new Date())).toBe(false)
expect(isAsyncFunction('')).toBe(false)
expect(isAsyncFunction([])).toBe(false)
expect(isAsyncFunction(new Date())).toBe(false)
- // eslint-disable-next-line prefer-regex-literals
- expect(isAsyncFunction(new RegExp('[a-z]', 'i'))).toBe(false)
+ expect(isAsyncFunction(/[a-z]/i)).toBe(false)
expect(isAsyncFunction(new Error())).toBe(false)
expect(isAsyncFunction(new Map())).toBe(false)
expect(isAsyncFunction(new Set())).toBe(false)
expect(isAsyncFunction(new Error())).toBe(false)
expect(isAsyncFunction(new Map())).toBe(false)
expect(isAsyncFunction(new Set())).toBe(false)
@@
-204,14
+206,14
@@
describe('Utils test suite', () => {
})
it('Verify min() behavior', () => {
})
it('Verify min() behavior', () => {
- expect(min()).toBe(
Infinity
)
+ expect(min()).toBe(
Number.POSITIVE_INFINITY
)
expect(min(1, 2)).toBe(1)
expect(min(2, 1)).toBe(1)
expect(min(1, 1)).toBe(1)
})
it('Verify max() behavior', () => {
expect(min(1, 2)).toBe(1)
expect(min(2, 1)).toBe(1)
expect(min(1, 1)).toBe(1)
})
it('Verify max() behavior', () => {
- expect(max()).toBe(
-Infinity
)
+ expect(max()).toBe(
Number.NEGATIVE_INFINITY
)
expect(max(1, 2)).toBe(2)
expect(max(2, 1)).toBe(2)
expect(max(1, 1)).toBe(1)
expect(max(1, 2)).toBe(2)
expect(max(2, 1)).toBe(2)
expect(max(1, 1)).toBe(1)