1 const { expect
} = require('expect')
2 const { ClusterWorker
} = require('../../lib')
4 describe('Cluster worker test suite', () => {
5 let numberOfMessagesSent
= 0
6 const send = function () {
9 class SpyWorker
extends ClusterWorker
{
15 it('Verify worker has default maxInactiveTime', () => {
16 const worker
= new ClusterWorker(() => {})
17 expect(worker
.opts
.maxInactiveTime
).toStrictEqual(60000)
20 it('Verify worker invokes the getMainWorker() and send() methods', () => {
21 const worker
= new SpyWorker(() => {})
22 worker
.sendToMainWorker({ ok
: 1 })
23 expect(numberOfMessagesSent
).toBe(1)