Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

150
Views
Node.js/Jest testing - expect(jest.fn()).toBeCalledWith()) throws an error about "Number of calls: 0"

I have a problem with one test that is created from other tests similar to it, the problem is that this one particular test does not pass and I cannot understand what is causing this.

Code:

    it('should call notify on the channel', done => {
      httpServicePostMock.mockReturnValue({
        subscribe: fn => {
          fn({ data: { data: { flightPlans: flightplanss } } });
          done();
        },
      });
      const channelNotifyMock = jest.fn();
      jest.spyOn(channelGateway, 'notify').mockImplementation(channelNotifyMock);

      controller.addSubscriptionByDgsId('clientId', 'stand2');
      expect(channelNotifyMock).toBeCalledWith(['clientId'], 'flight_plans/stand2', JSON.stringify(flightplanss));
    });
  });

And the error says that number of calls is equal to 0.

enter image description here

Maybe someone can give me a hint how to fix it?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!