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

197
Views
La prueba de mocha pasó pero no está esperando que la prueba cumpla con la condición if else.

Estoy tratando de crear una base de datos utilizando la primera llamada a la API y la segunda API obtiene el estado de la base de datos creada. ¿Alguien puede decir por qué no está esperando que se pase el estado y marcando los casos de prueba para pasar en ejecución?

 'Verify that new database created successfully': async function () { //const dataStartServer = syncSuite.loginInf.endpoint; const request = supertest(syncSuite.list.API_URL); const random = Math.floor(Math.random() * 30) + 1; const data = { 'notifyMe': false }; const res = await request .post(`${pathapi.create_server}DatabaseJ Server${random}`) .set('Cookie', syncSuite.list.Token, 'Host', syncSuite.list.API_URL, 'Content-Type', 'application/x-www-form-urlencoded') .send(data); // .expect(200); //console.log('Status of server----------------------------', res.body) let uuid = res.body.uuid; //let createdServer = res.body.name let attemptsLeft = 30; const expectedValue = 'passed'; const delayBetweenRequest = 60000; async function check() { const status_res = await request .get(`${pathapi.status_path}${uuid}`) .set('Cookie', syncSuite.list.Token, 'Host', syncSuite.list.API_URL, 'Content-Type', 'application/x-www-form-urlencoded') .send() // .expect(200); console.log('log---------------------------', status_res.body.status) if (status_res.body.status === expectedValue) { expect(status_res.body.status).to.be.eq(expectedValue) } else { attemptsLeft -= 1; console.log('Status of server----------------------------', status_res.body, attemptsLeft) if (!attemptsLeft) { expect(false) } else { setTimeout(check, delayBetweenRequest); } } }`enter code here` check(); },
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!