]> Piment Noir Git Repositories - poolifier.git/blobdiff - tests/utils.test.mjs
build(deps-dev): bump the regular group across 11 directories with 1 update (#2920)
[poolifier.git] / tests / utils.test.mjs
index bf6d3f08a6480be8e1470f242321300e184e66a8..92bbcbc78d033fd646da0b47755fa29a8a75cfd5 100644 (file)
@@ -1,8 +1,7 @@
+import { expect } from '@std/expect'
 import { randomInt } from 'node:crypto'
 import os from 'node:os'
 
-import { expect } from 'expect'
-
 import { KillBehaviors } from '../lib/index.cjs'
 import {
   availableParallelism,
@@ -19,7 +18,7 @@ import {
   // once,
   round,
   secureRandom,
-  sleep
+  sleep,
 } from '../lib/utils.cjs'
 
 describe('Utils test suite', () => {
@@ -149,8 +148,7 @@ describe('Utils test suite', () => {
     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)
@@ -182,12 +180,12 @@ describe('Utils test suite', () => {
     expect(isAsyncFunction(async function () {})).toBe(true)
     expect(isAsyncFunction(async function named () {})).toBe(true)
     class TestClass {
-      testSync () {}
-      async testAsync () {}
-      testArrowSync = () => {}
-      testArrowAsync = async () => {}
-      static testStaticSync () {}
       static async testStaticAsync () {}
+      static testStaticSync () {}
+      testArrowAsync = async () => {}
+      testArrowSync = () => {}
+      async testAsync () {}
+      testSync () {}
     }
     const testClass = new TestClass()
     expect(isAsyncFunction(testClass.testSync)).toBe(false)
@@ -206,14 +204,14 @@ describe('Utils test suite', () => {
   })
 
   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(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)