Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

173
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda