repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
chore: v2.4.5
[poolifier.git]
/
tests
/
worker
/
abstract-worker.test.js
diff --git
a/tests/worker/abstract-worker.test.js
b/tests/worker/abstract-worker.test.js
index c75227cc0bd8fcb8f0de0fe3f4b1b025e513245a..fbc9a06d26082b007d01572e95f02f610dc1f1a5 100644
(file)
--- a/
tests/worker/abstract-worker.test.js
+++ b/
tests/worker/abstract-worker.test.js
@@
-5,16
+5,22
@@
describe('Abstract worker test suite', () => {
class StubPoolWithIsMainWorker extends ThreadWorker {
constructor (fn, opts) {
super(fn, opts)
class StubPoolWithIsMainWorker extends ThreadWorker {
constructor (fn, opts) {
super(fn, opts)
- this.mainWorker =
false
+ this.mainWorker =
undefined
}
}
}
}
- it('Verify that fn
function
is mandatory', () => {
+ it('Verify that fn
parameter
is mandatory', () => {
expect(() => new ClusterWorker()).toThrowError(
new Error('fn parameter is mandatory')
)
})
expect(() => new ClusterWorker()).toThrowError(
new Error('fn parameter is mandatory')
)
})
+ it('Verify that fn parameter is a function', () => {
+ expect(() => new ClusterWorker({})).toThrowError(
+ new TypeError('fn parameter is not a function')
+ )
+ })
+
it('Verify worker options default values', () => {
const worker = new ThreadWorker(() => {})
expect(worker.opts.maxInactiveTime).toStrictEqual(60000)
it('Verify worker options default values', () => {
const worker = new ThreadWorker(() => {})
expect(worker.opts.maxInactiveTime).toStrictEqual(60000)
@@
-36,7
+42,7
@@
describe('Abstract worker test suite', () => {
it('Verify that handleError function is working properly', () => {
const error = new Error('My error')
const worker = new ThreadWorker(() => {})
it('Verify that handleError function is working properly', () => {
const error = new Error('My error')
const worker = new ThreadWorker(() => {})
- expect(worker.handleError(error)).to
Be
(error)
+ expect(worker.handleError(error)).to
StrictEqual
(error)
})
it('Verify that get main worker throw error if main worker is not set', () => {
})
it('Verify that get main worker throw error if main worker is not set', () => {