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

161
Views
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
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!