Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

165
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda