+ expect(() => new ThreadWorker({ fn1: { fn1 } })).toThrow(
+ new TypeError(
+ "taskFunction object 'taskFunction' property 'undefined' is not a function"
+ )
+ )
+ expect(() => new ThreadWorker({ fn2: { taskFunction: fn2 } })).toThrow(
+ new TypeError(
+ "taskFunction object 'taskFunction' property '' is not a function"
+ )
+ )
+ expect(
+ () => new ThreadWorker({ fn1: { taskFunction: fn1, priority: '' } })
+ ).toThrow(new TypeError("Invalid priority ''"))
+ expect(
+ () => new ThreadWorker({ fn1: { taskFunction: fn1, priority: -21 } })
+ ).toThrow(new TypeError('Property priority must be between -20 and 19'))
+ expect(
+ () => new ThreadWorker({ fn1: { taskFunction: fn1, priority: 20 } })
+ ).toThrow(new RangeError('Property priority must be between -20 and 19'))
+ expect(
+ () =>
+ new ThreadWorker({
+ fn1: { taskFunction: fn1, strategy: 'invalidStrategy' }
+ })
+ ).toThrow(
+ new RangeError("Invalid worker choice strategy 'invalidStrategy'")
+ )