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

152
Views
Cómo usar Nock con moka

Estoy usando nock con mocha para pruebas de restapi. pero cuando usé .reply(200,"msg" :"url matched") .solo verifican 200 respuestas en la codificación del servidor. cómo se utiliza de manera adecuada. mi código se da a continuación: es un caso negativo. en realidad muestran una respuesta 404 . pero cuando uso 200 pasaron este caso de prueba.

 it("test case for /hotel/:id/location api", function (done) { nock("http://localhost:3010") .get('/hotel/1/location') .reply(200, {'msg': 'response matched'}); server .get("/hotel/1/location") .expect("Content-type", /json/) .end(function (err, res) { if (res.success == false) { res.status.should.equal(200); } if (err) { res.body.error.should.equal(true); } done(); }); nock.cleanAll(); }); });
about 4 years ago · Santiago Trujillo
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!