Page MenuHomePhabricator

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

Authored by bytesofman on Mar 2 2024, 04:16.

Details

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

Diff Detail

Event Timeline

The build failed due to an unexpected infrastructure outage. The administrators have been notified to investigate. Sorry for the inconvenience.
bytesofman published this revision for review.Mar 2 2024, 06:27
This revision is now accepted and ready to land.Mar 2 2024, 09:33