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

542
Views
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
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!