You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I would like to know if its possible to test named job processor calls after call the queue add method using jest. Also, an example of how to accomplish this would be great.
Minimal, Working Test code to reproduce the issue.
// worker.test.jstest(`Should call the fruitHandler`,()=>{constworker=require('./worker'),job={fruitId: 1};worker.fruitHandler=jest.fn(()=>Promise.resolve({}));// calling the producer fruitQueue.add('updateFruit',job);worker.fruitHandler).toHaveBeenCalledTimes(1)// also tried waiting // setTimeout(expect(worker.updateInElasticById).toHaveBeenCalledTimes(1), 1000));
The response always is:
Error: expect(jest.fn()).toHaveBeenCalledTimes(expected)
Expected number of calls: 1
Received number of calls: 0
Bull version
3.20.1
Additional information
I've already tried mocking the bull lib. Also, ioredis-mock following this thread and of course using fully working redis instance up and running.
The text was updated successfully, but these errors were encountered:
ealcantara22
changed the title
Queston: Is it possible to unit test named job proccess hanlder calls with jest?
Queston: Is it possible to unit test named job proccess handler calls with jest?
Apr 8, 2021
Description
Hello, I would like to know if its possible to test named job processor calls after call the queue
add
method using jest. Also, an example of how to accomplish this would be great.Minimal, Working Test code to reproduce the issue.
Looking to accomplish something like:
The response always is:
Bull version
3.20.1
Additional information
I've already tried mocking the bull lib. Also, ioredis-mock following this thread and of course using fully working redis instance up and running.
The text was updated successfully, but these errors were encountered: