test: ensure the worker choice context class is properly initialized
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 7 Apr 2023 11:46:58 +0000 (13:46 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 7 Apr 2023 11:46:58 +0000 (13:46 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
tests/pools/selection-strategies/worker-choice-strategy-context.test.js

index 2c0250efba1ad99544e0818b4bf018ed880c623a..a8f187eee6098fab5bb6c8ede3ec5cff434da3d3 100644 (file)
@@ -50,6 +50,15 @@ describe('Worker choice strategy context test suite', () => {
     await dynamicPool.destroy()
   })
 
+  it('Verify that constructor() initializes the context with all the available worker choice strategies', () => {
+    const workerChoiceStrategyContext = new WorkerChoiceStrategyContext(
+      fixedPool
+    )
+    expect(workerChoiceStrategyContext.workerChoiceStrategies.size).toBe(
+      Object.keys(WorkerChoiceStrategies).length
+    )
+  })
+
   it('Verify that execute() return the worker chosen by the strategy with fixed pool', () => {
     const workerChoiceStrategyContext = new WorkerChoiceStrategyContext(
       fixedPool