repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
refactor: add PoolEvents/PoolEvent types
[poolifier.git]
/
tests
/
pools
/
cluster
/
fixed.test.js
diff --git
a/tests/pools/cluster/fixed.test.js
b/tests/pools/cluster/fixed.test.js
index e00e5fa331d7231d0cacd862c22adeb29c6c9f66..908acbfe84530f59d3facb59cfec315df7333cd1 100644
(file)
--- a/
tests/pools/cluster/fixed.test.js
+++ b/
tests/pools/cluster/fixed.test.js
@@
-1,5
+1,5
@@
const { expect } = require('expect')
const { expect } = require('expect')
-const { FixedClusterPool } = require('../../../lib/index')
+const { FixedClusterPool
, PoolEvents
} = require('../../../lib/index')
const { WorkerFunctions } = require('../../test-types')
const TestUtils = require('../../test-utils')
const { WorkerFunctions } = require('../../test-types')
const TestUtils = require('../../test-utils')
@@
-49,14
+49,6
@@
describe('Fixed cluster pool test suite', () => {
await emptyPool.destroy()
})
await emptyPool.destroy()
})
- it('Choose worker round robin test', async () => {
- const results = new Set()
- for (let i = 0; i < numberOfWorkers; i++) {
- results.add(pool.chooseWorker().id)
- }
- expect(results.size).toBe(numberOfWorkers)
- })
-
it('Verify that the function is executed in a worker cluster', async () => {
let result = await pool.execute({
function: WorkerFunctions.fibonacci
it('Verify that the function is executed in a worker cluster', async () => {
let result = await pool.execute({
function: WorkerFunctions.fibonacci
@@
-73,9
+65,9
@@
describe('Fixed cluster pool test suite', () => {
expect(result).toBe(false)
})
expect(result).toBe(false)
})
- it(
'Verify that busy event is emitted'
, async () => {
+ it(
"Verify that 'busy' event is emitted"
, async () => {
let poolBusy = 0
let poolBusy = 0
- pool.emitter.on(
'busy', () => poolBusy++
)
+ pool.emitter.on(
PoolEvents.busy, () => ++poolBusy
)
for (let i = 0; i < numberOfWorkers * 2; i++) {
pool.execute()
}
for (let i = 0; i < numberOfWorkers * 2; i++) {
pool.execute()
}