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

110
Vistas
Test script still runs with the couchDB error message in the mocha framework for javascript/nodeJS using promises

'Verify that new database created successfully': async function () {
        const request = supertest(syncSuite.list.API_URL);
        const random = Math.floor(Math.random() * 30) + 1;
        const data = {
            'notifyMe': false
        };
        const createdRes = await request
            .post(`${pathapi.create_server}APIDatabase Server${random}`)
            .set('Cookie', syncSuite.list.Token, 'Host', syncSuite.list.API_URL,
                'Content-Type', 'application/x-www-form-urlencoded')
            .send(data)
            .expect(200);
        createdServer = createdRes.body.name;
        let uuid = createdRes.body.uuid;

        let attemptsLeft = 50;
        const expectedValue = 'passed';
        const delayBetweenRequest = 60000;

        const check = async () => new Promise((resolve, reject) => {
            setTimeout(async () => {
                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();
                resolve(status_res.body);
            }, delayBetweenRequest);
        }
        );
        for (var i = 1; i <= attemptsLeft; i++) {
            const res = await check();
            console.log("res=============================", res);
            if (res.status === expectedValue) {
                expect(res.status).to.be.eq(expectedValue);
                break;
            } else if (i === attemptsLeft) {
                expect(false);
            }
        }
    },

enter image description here

Problem Question: as per the console.log i am getting the correct response and waiting for the res.status to be equal to passed and exit the loop but the problem is here, when its passed and DB has been created in the backed, my test script still runs with the couchDB error message(as show in the picture) in the logs and keeps on running the script unless i get the timeout error. what is the possible solution for this?

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