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

187
Vistas
How do I get a nock test to pass with a post body?

I have:

it.only('should trigger the Partner Client Service on error', async () => {
            const partnerServiceScope = nock(PARTNER_SERVICE_URL)
                .post('/api/v1/webhooks/event', {
                    type: 'member_info_needed',
                    data: { user_id: 'user123' },
                })
                .reply(200, {})

            try {
                await eligibilityService.getEligibility('user123')
            } catch (e) {
                expect(partnerServiceScope.isDone()).toBeTruthy()
            }
        })

The getEligibility has:

    async getEligibility(userId: string): Promise<EligibilityForPayer> {
        const eligibilityRecord =
            await stuff(userId)

        if (!eligibilityRecord) {
            void this.partnerService.postPartnerServiceEvent({
                type: PartnerServiceEventType.MemberInfoNeeded,
                data: {
                    user_id: userId,
                },
            })

The this.partnerService.postPartnerServiceEvent has:

            const res: AxiosResponse<unknown> = await partnerServiceClient.post(
                '/api/v1/webhooks/event',
                partnerServiceEvent,
            )
            return res.data

I can see that the test gets there, but the test does not return truth. What am I doing wrong?

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