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