test(storage): fix assert.throws and assert.rejects violations - #9212
test(storage): fix assert.throws and assert.rejects violations#9212thiyaguk09 wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors several test files under handwritten/storage/test/ to improve type safety, fix incorrect assertion patterns, and clean up asynchronous code. Notably, it corrects broken assert.throws usages (which previously used comma expressions that did not actually validate the error message) by wrapping the expected error messages in new RegExp(...). It also replaces Promise.resolve().then(...) with process.nextTick(...) for asynchronous callbacks, adds missing await keywords to assert.rejects calls, and replaces any types with more specific types. The review feedback recommends further improving the assert.throws assertions by passing a validation object with a message property (e.g., { message: ... }) instead of using new RegExp(...), which is cleaner, avoids regex compilation overhead, and ensures a strict equality check.
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here> 🦕