expect(killHandlerStub.calledOnce).toBe(true)
})
- it('Verify that handleError() method is working properly', () => {
- const error = new Error('Error as an error')
- const worker = new ClusterWorker(() => {})
- expect(worker.handleError(error)).not.toBeInstanceOf(Error)
- expect(worker.handleError(error)).toStrictEqual(error.message)
- const errorMessage = 'Error as a string'
- expect(worker.handleError(errorMessage)).toStrictEqual(errorMessage)
- })
-
it('Verify that getMainWorker() throw error if main worker is not set', () => {
expect(() =>
new StubWorkerWithMainWorker(() => {}).getMainWorker()
}
}
+ it('Verify that handleError() method is working properly', () => {
+ const error = new Error('Error as an error')
+ const worker = new ClusterWorker(() => {})
+ expect(worker.handleError(error)).not.toBeInstanceOf(Error)
+ expect(worker.handleError(error)).toStrictEqual(error.message)
+ const errorMessage = 'Error as a string'
+ expect(worker.handleError(errorMessage)).toStrictEqual(errorMessage)
+ })
+
it('Verify worker invokes the getMainWorker() and send() methods', () => {
const worker = new SpyWorker(() => {})
worker.sendToMainWorker({ ok: 1 })
it('Verify that handleError() method is working properly', () => {
const error = new Error('Error as an error')
const worker = new ThreadWorker(() => {})
+ expect(worker.handleError(error)).toBeInstanceOf(Error)
expect(worker.handleError(error)).toStrictEqual(error)
const errorMessage = 'Error as a string'
expect(worker.handleError(errorMessage)).toStrictEqual(errorMessage)