const workerNotFoundInTasksUsageMapError = new Error(
'Worker could not be found in workers tasks usage map'
)
- class StubPoolWithWorkerTasksUsageMapClear extends FixedThreadPool {
+ class StubPoolWithRemoveAllWorker extends FixedThreadPool {
removeAllWorker () {
+ this.workers = []
this.workersTasksUsage.clear()
+ this.promiseMap.clear()
}
}
- class StubPoolWithIsMainMethod extends FixedThreadPool {
+ class StubPoolWithIsMain extends FixedThreadPool {
isMain () {
return false
}
it('Simulate pool creation from a non main thread/process', () => {
expect(
() =>
- new StubPoolWithIsMainMethod(
+ new StubPoolWithIsMain(
numberOfWorkers,
'./tests/worker-files/thread/testWorker.js',
{
})
it('Simulate worker not found during increaseWorkerRunningTasks', async () => {
- const pool = new StubPoolWithWorkerTasksUsageMapClear(
+ const pool = new StubPoolWithRemoveAllWorker(
numberOfWorkers,
'./tests/worker-files/cluster/testWorker.js'
)
})
it('Simulate worker not found during decreaseWorkerRunningTasks', async () => {
- const pool = new StubPoolWithWorkerTasksUsageMapClear(
+ const pool = new StubPoolWithRemoveAllWorker(
numberOfWorkers,
'./tests/worker-files/cluster/testWorker.js',
{
})
it('Simulate worker not found during stepWorkerRunTasks', async () => {
- const pool = new StubPoolWithWorkerTasksUsageMapClear(
+ const pool = new StubPoolWithRemoveAllWorker(
numberOfWorkers,
'./tests/worker-files/cluster/testWorker.js',
{
})
it('Simulate worker not found during updateWorkerTasksRunTime with strategy not requiring it', async () => {
- const pool = new StubPoolWithWorkerTasksUsageMapClear(
+ const pool = new StubPoolWithRemoveAllWorker(
numberOfWorkers,
'./tests/worker-files/cluster/testWorker.js',
{
})
it('Simulate worker not found during updateWorkerTasksRunTime with strategy requiring it', async () => {
- const pool = new StubPoolWithWorkerTasksUsageMapClear(
+ const pool = new StubPoolWithRemoveAllWorker(
numberOfWorkers,
'./tests/worker-files/cluster/testWorker.js',
{