test: cleanup helpers
[poolifier.git] / src / pools / selection-strategies / worker-choice-strategy-context.ts
index a0ba25838dc524ea678c97701e20ac7aa1f7b413..e1332b85f150d30395cff0938371290765032f1f 100644 (file)
@@ -9,6 +9,7 @@ import { LeastEluWorkerChoiceStrategy } from './least-elu-worker-choice-strategy
 import { RoundRobinWorkerChoiceStrategy } from './round-robin-worker-choice-strategy'
 import type {
   IWorkerChoiceStrategy,
+  StrategyPolicy,
   TaskStatisticsRequirements,
   WorkerChoiceStrategy,
   WorkerChoiceStrategyOptions
@@ -104,6 +105,19 @@ export class WorkerChoiceStrategyContext<
     ])
   }
 
+  /**
+   * Gets the strategy policy in the context.
+   *
+   * @returns The strategy policy.
+   */
+  public getStrategyPolicy (): StrategyPolicy {
+    return (
+      this.workerChoiceStrategies.get(
+        this.workerChoiceStrategy
+      ) as IWorkerChoiceStrategy
+    ).strategyPolicy
+  }
+
   /**
    * Gets the worker choice strategy task statistics requirements in the context.
    *