HomePhabricator

[mock-chronik-client] Make sure assert rejects is called properly in tests

Description

[mock-chronik-client] Make sure assert rejects is called properly in tests

Summary:
ref https://nodejs.org/api/assert.html#assertrejectsasyncfn-error-message

Libraries like chai are often used to avoid this, but we need to upgrade our node apps to use es6 before we can use those.

node assert is fine except for the kind of annoying issue of...if you use the wrong syntax when testing errors, your tests could just appear to pass even when they are bad.

Test Plan:
npm test

Pick one of the error tests before this change, change expectedError to 'some string', test still passes
Pick one of the error tests, change expectedError to new Error('not the right msg') and get a failure

Reviewers: #bitcoin_abc, emack

Reviewed By: #bitcoin_abc, emack

Differential Revision: https://reviews.bitcoinabc.org/D15606

Details

Provenance
bytesofmanAuthored on Mar 2 2024, 04:14
bytesofmanPushed on Mar 2 2024, 13:36
Reviewer
Restricted Project
Differential Revision
D15606: [mock-chronik-client] Make sure assert rejects is called properly in tests
Parents
rABCbbfbef216a5e: [Cashtab] Fix bugs in parseChronikTx
Branches
Unknown
Tags
Unknown