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

545
Vistas
Expected one matching request for criteria "Match URL: http://localhost:8080/api/members/1/skills", found none

I am trying to test a method from a service that performs a http POST request. The thing is that Jasmine is throwing the following error:

Jasmine spec failure list:

Error: Expected one matching request for criteria "Match URL: http://localhost:8080/api/members/1/skills", found none.

Can anyone explain me what is wrong? Actually, the url is correct, so I don't know what is going on.

This is the method I want to test:

postSkillforMember(memberId: string, skillFormBody: any, successCallback: Function, errorCallback: Function) {

    console.log(`${this._membersUrl}/${memberId}/skills`);

    this._http

      .post<Skill>(`${this._membersUrl}/${memberId}/skills`, skillFormBody, {

        headers: new HttpHeaders({ 'Content-Type': 'application/json' }),

        responseType: 'json',

        observe: 'body',

      })

      .subscribe({

        next: (value) => {

          this.newSkill = value;

        },

        complete: () => {

          successCallback(this.newSkill);



        },

        error: (error) => { catchError(this.handleError);

          errorCallback(error);

        }

    });

  }

This is my it in spec.ts:

it('Testing postSkillforMember() success', () => {

    const skillFormBody = {

      skill: {

          "id": '1',

          "skill": ""

      },

      skillLevel: {

          "id": '1',

          "skillLevel": ""

      }

    }

    let successCb: boolean = false;

    mockSkillAddService.postSkillforMember(memberMockObject.fakeMember.id.toString(), skillFormBody, ()=>{ successCb = true }, ()=>{});

    const req = mockHttpTestingController.expectOne(`http://localhost:8080/api/members/1/skills`);

 

    const expectedResponse = new HttpResponse({ status: 201, statusText: 'Created' });

    req.event(expectedResponse);



    const msg = '201 Created';

    req.flush(msg, { status: 201, statusText: 'Created' });

    expect(successCb).toBeTruthy();

  });

Thank you in advance for your help, I really appreciate 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