Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

170
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda