repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge dependabot/npm_and_yarn/mocha-10.5.0 into combined-prs-branch
[poolifier.git]
/
tests
/
worker
/
thread-worker.test.mjs
diff --git
a/tests/worker/thread-worker.test.mjs
b/tests/worker/thread-worker.test.mjs
index 3151b90a4a04d367e262f9f3cee8bf8569bc25c4..f78451f7d95482a33660076d71408c073661fc66 100644
(file)
--- a/
tests/worker/thread-worker.test.mjs
+++ b/
tests/worker/thread-worker.test.mjs
@@
-19,13
+19,13
@@
describe('Thread worker test suite', () => {
it('Verify that sync kill handler is called when worker is killed', () => {
const worker = new ThreadWorker(() => {}, {
it('Verify that sync kill handler is called when worker is killed', () => {
const worker = new ThreadWorker(() => {}, {
- killHandler: stub().returns()
+ killHandler: stub().returns()
,
})
worker.isMain = false
worker.port = {
postMessage: stub().returns(),
unref: stub().returns(),
})
worker.isMain = false
worker.port = {
postMessage: stub().returns(),
unref: stub().returns(),
- close: stub().returns()
+ close: stub().returns()
,
}
worker.handleKillMessage()
expect(worker.port.postMessage.calledOnce).toBe(true)
}
worker.handleKillMessage()
expect(worker.port.postMessage.calledOnce).toBe(true)
@@
-43,24
+43,24
@@
describe('Thread worker test suite', () => {
}
const worker = new ThreadWorker({ fn1, fn2 })
worker.port = {
}
const worker = new ThreadWorker({ fn1, fn2 })
worker.port = {
- postMessage: stub().returns()
+ postMessage: stub().returns()
,
}
expect(worker.removeTaskFunction(0, fn1)).toStrictEqual({
status: false,
}
expect(worker.removeTaskFunction(0, fn1)).toStrictEqual({
status: false,
- error: new TypeError('name parameter is not a string')
+ error: new TypeError('name parameter is not a string')
,
})
expect(worker.removeTaskFunction('', fn1)).toStrictEqual({
status: false,
})
expect(worker.removeTaskFunction('', fn1)).toStrictEqual({
status: false,
- error: new TypeError('name parameter is an empty string')
+ error: new TypeError('name parameter is an empty string')
,
})
expect(worker.taskFunctions.get(DEFAULT_TASK_NAME)).toStrictEqual({
})
expect(worker.taskFunctions.get(DEFAULT_TASK_NAME)).toStrictEqual({
- taskFunction: expect.any(Function)
+ taskFunction: expect.any(Function)
,
})
expect(worker.taskFunctions.get('fn1')).toStrictEqual({
})
expect(worker.taskFunctions.get('fn1')).toStrictEqual({
- taskFunction: expect.any(Function)
+ taskFunction: expect.any(Function)
,
})
expect(worker.taskFunctions.get('fn2')).toStrictEqual({
})
expect(worker.taskFunctions.get('fn2')).toStrictEqual({
- taskFunction: expect.any(Function)
+ taskFunction: expect.any(Function)
,
})
expect(worker.taskFunctions.size).toBe(3)
expect(worker.taskFunctions.get(DEFAULT_TASK_NAME)).toStrictEqual(
})
expect(worker.taskFunctions.size).toBe(3)
expect(worker.taskFunctions.get(DEFAULT_TASK_NAME)).toStrictEqual(
@@
-70,20
+70,20
@@
describe('Thread worker test suite', () => {
status: false,
error: new Error(
'Cannot remove the task function with the default reserved name'
status: false,
error: new Error(
'Cannot remove the task function with the default reserved name'
- )
+ )
,
})
expect(worker.removeTaskFunction('fn1')).toStrictEqual({
status: false,
error: new Error(
'Cannot remove the task function used as the default task function'
})
expect(worker.removeTaskFunction('fn1')).toStrictEqual({
status: false,
error: new Error(
'Cannot remove the task function used as the default task function'
- )
+ )
,
})
worker.removeTaskFunction('fn2')
expect(worker.taskFunctions.get(DEFAULT_TASK_NAME)).toStrictEqual({
})
worker.removeTaskFunction('fn2')
expect(worker.taskFunctions.get(DEFAULT_TASK_NAME)).toStrictEqual({
- taskFunction: expect.any(Function)
+ taskFunction: expect.any(Function)
,
})
expect(worker.taskFunctions.get('fn1')).toStrictEqual({
})
expect(worker.taskFunctions.get('fn1')).toStrictEqual({
- taskFunction: expect.any(Function)
+ taskFunction: expect.any(Function)
,
})
expect(worker.taskFunctions.get('fn2')).toBeUndefined()
expect(worker.taskFunctions.size).toBe(2)
})
expect(worker.taskFunctions.get('fn2')).toBeUndefined()
expect(worker.taskFunctions.size).toBe(2)