- expect(() => worker.addTaskFunction(0, fn1)).toThrowError(
- new TypeError('name parameter is not a string')
- )
- expect(() => worker.addTaskFunction('', fn1)).toThrowError(
- new TypeError('name parameter is an empty string')
- )
- expect(() => worker.addTaskFunction('fn3', '')).toThrowError(
- new TypeError('fn parameter is not a function')
- )
- expect(worker.taskFunctions.get('default')).toBeInstanceOf(Function)
+ expect(worker.addTaskFunction(0, fn1)).toStrictEqual({
+ status: false,
+ error: new TypeError('name parameter is not a string')
+ })
+ expect(worker.addTaskFunction('', fn1)).toStrictEqual({
+ status: false,
+ error: new TypeError('name parameter is an empty string')
+ })
+ expect(worker.addTaskFunction('fn3', '')).toStrictEqual({
+ status: false,
+ error: new TypeError('fn parameter is not a function')
+ })
+ expect(worker.taskFunctions.get(DEFAULT_TASK_NAME)).toBeInstanceOf(Function)