*/
findFreeWorkerNodeKey: () => number
/**
- * Performs the task specified in the constructor with the data parameter.
+ * Execute the function specified in the constructor with the task data parameter.
*
* @param data - The input for the specified task. This can only be serializable data.
* @returns Promise that will be resolved when the task is successfully completed.
expect(result).toBe(false)
})
- it('Verify that is possible to invoke the execute method without input', async () => {
+ it('Verify that is possible to invoke the execute() method without input', async () => {
const result = await pool.execute()
expect(result).toBe(false)
})
expect(result).toBe(false)
})
- it('Verify that is possible to invoke the execute method without input', async () => {
+ it('Verify that is possible to invoke the execute() method without input', async () => {
const result = await pool.execute()
expect(result).toBe(false)
})
)
})
- it('Verify that handleError function is working properly', () => {
+ it('Verify that handleError() method is working properly', () => {
const error = new Error('My error')
const worker = new ThreadWorker(() => {})
expect(worker.handleError(error)).toStrictEqual(error)
})
- it('Verify that get main worker throw error if main worker is not set', () => {
+ it('Verify that getMainWorker() throw error if main worker is not set', () => {
expect(() =>
new StubPoolWithIsMainWorker(() => {}).getMainWorker()
).toThrowError('Main worker was not set')
expect(worker.opts.maxInactiveTime).toStrictEqual(60000)
})
- it('Verify that handleError function works properly', () => {
+ it('Verify that handleError() method works properly', () => {
const errorMessage = 'Error as a string'
const worker = new ClusterWorker(() => {})
expect(worker.handleError(errorMessage)).toStrictEqual(errorMessage)
expect(worker.opts.maxInactiveTime).toStrictEqual(60000)
})
- it('Verify worker invoke the getMainWorker and postMessage methods', () => {
+ it('Verify worker invoke the getMainWorker() and postMessage() methods', () => {
const worker = new SpyWorker(() => {})
worker.sendToMainWorker({ ok: 1 })
expect(numberOfMessagesPosted).toBe(1)