refactor: cleanup .gitignore
[poolifier.git] / tests / worker / cluster-worker.test.mjs
CommitLineData
a074ffee
JB
1import { expect } from 'expect'
2import { ClusterWorker } from '../../lib/index.js'
fd027a65
S
3
4describe('Cluster worker test suite', () => {
f4fb3543 5 let numberOfMessagesSent = 0
440dd7d7 6 const send = () => {
f4fb3543
JB
7 ++numberOfMessagesSent
8 }
9 class SpyWorker extends ClusterWorker {
10 getMainWorker () {
11 return { send }
12 }
13 }
14
2431bdb4 15 it('Verify worker invokes the getMainWorker() and send() methods', () => {
f4fb3543
JB
16 const worker = new SpyWorker(() => {})
17 worker.sendToMainWorker({ ok: 1 })
18 expect(numberOfMessagesSent).toBe(1)
19 })
fd027a65 20})