Apply dependencies update
[poolifier.git] / tests / pools / selection-strategies / selection-strategies-utils.test.js
index ba9545f9ae93bfba4bee1984fe17318c4ac96606..eaac1342337eae176466a80adb06547d52e609ae 100644 (file)
@@ -1,7 +1,7 @@
 const { expect } = require('expect')
 // const sinon = require('sinon')
 const {
-  SelectionStrategiesUtils
+  getWorkerChoiceStrategy
 } = require('../../../lib/pools/selection-strategies/selection-strategies-utils')
 const {
   FixedThreadPool,
@@ -32,17 +32,17 @@ describe('Selection strategies utils test suite', () => {
   //   sinon.restore()
   // })
 
-  after(() => {
-    pool.destroy()
+  after(async () => {
+    await pool.destroy()
   })
 
   it('Verify that getWorkerChoiceStrategy() default return ROUND_ROBIN strategy', () => {
-    const strategy = SelectionStrategiesUtils.getWorkerChoiceStrategy(pool)
+    const strategy = getWorkerChoiceStrategy(pool)
     expect(strategy).toBeInstanceOf(RoundRobinWorkerChoiceStrategy)
   })
 
   it('Verify that getWorkerChoiceStrategy() can return ROUND_ROBIN strategy', () => {
-    const strategy = SelectionStrategiesUtils.getWorkerChoiceStrategy(
+    const strategy = getWorkerChoiceStrategy(
       pool,
       WorkerChoiceStrategies.ROUND_ROBIN
     )
@@ -50,7 +50,7 @@ describe('Selection strategies utils test suite', () => {
   })
 
   it('Verify that getWorkerChoiceStrategy() can return LESS_RECENTLY_USED strategy', () => {
-    const strategy = SelectionStrategiesUtils.getWorkerChoiceStrategy(
+    const strategy = getWorkerChoiceStrategy(
       pool,
       WorkerChoiceStrategies.LESS_RECENTLY_USED
     )
@@ -58,7 +58,7 @@ describe('Selection strategies utils test suite', () => {
   })
 
   it('Verify that getWorkerChoiceStrategy() can return FAIR_SHARE strategy', () => {
-    const strategy = SelectionStrategiesUtils.getWorkerChoiceStrategy(
+    const strategy = getWorkerChoiceStrategy(
       pool,
       WorkerChoiceStrategies.FAIR_SHARE
     )
@@ -66,7 +66,7 @@ describe('Selection strategies utils test suite', () => {
   })
 
   it('Verify that getWorkerChoiceStrategy() can return WEIGHTED_ROUND_ROBIN strategy', () => {
-    const strategy = SelectionStrategiesUtils.getWorkerChoiceStrategy(
+    const strategy = getWorkerChoiceStrategy(
       pool,
       WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN
     )
@@ -75,7 +75,7 @@ describe('Selection strategies utils test suite', () => {
 
   it('Verify that getWorkerChoiceStrategy() throw error on unknown strategy', () => {
     expect(() => {
-      SelectionStrategiesUtils.getWorkerChoiceStrategy(pool, 'UNKNOWN_STRATEGY')
+      getWorkerChoiceStrategy(pool, 'UNKNOWN_STRATEGY')
     }).toThrowError(
       new Error("Worker choice strategy 'UNKNOWN_STRATEGY' not found")
     )