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

164
Vistas
qldb nodejs unit test

Trying to create some useful unit tests for the node qldb driver. A common use case is that you open a transaction with executeLambda(), check if your item exists, if it does not insert, exit transaction.

simple code example would look like this ;

return await client.executeLambda(async (txn) => {
    const res = (
        await txn.execute(
            "SELECT * FROM Foo WHERE Bar = ?",
            "FooBar"
        )
    ).getResultList();

    if (res.length == 0) {

        const foo = { Bar = "FooBar"};
        await txn.execute("INSERT INTO Foo ?", foo);

        return foo;
    } else {
        return res[0];
    }
});

Mocking executeLambda to return some resolved promise with an object is easy but, how to test that the TransactionExecutor was ran multiple times and with specific queries etc. How to mock the first execute to return an array with a item to hit the second execute ...

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