Repository navigation
test(approval-controller): assert the error codes the expectations describe - #10576
Merged
Merged
Conversation
OGPoyraz
previously approved these changes
Sep 29, 2026
cryptodev-2s
force-pushed
the
test/approval-controller-assert-error-codes
branch
from
September 30, 2026 07:04
c812b32 to
bb0a88a
Compare
cryptodev-2s
dismissed
OGPoyraz’s stale review
October 5, 2026 09:40
The merge-base changed after approval.
cryptodev-2s
force-pushed
the
test/approval-controller-assert-error-codes
branch
from
October 5, 2026 10:48
bb0a88a to
37d7aa9
Compare
cryptodev-2s
force-pushed
the
test/approval-controller-assert-error-codes
branch
2 times, most recently
from
October 12, 2026 15:43
a91eb5e to
9404b82
Compare
cryptodev-2s
force-pushed
the
test/approval-controller-assert-error-codes
branch
from
October 14, 2026 09:23
9404b82 to
bcbf6e0
Compare
OGPoyraz
approved these changes
Oct 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
getErrorreturned a plain object, andtoThrowgiven a plain object compares only itsmessage. Every error code in this file was decoration: swapping one for a wrong value keeps the suite green.These expectations now read the thrown error and assert message and code. The code is asserted unconditionally, so the paths that throw a plain
Errorare pinned to having none. Every code already in the file was correct, so nothing changes behaviourally, they are simply checked now.rejects.toThrow(error)has the same blind spot for a customErrorsubclass, so the one rejection path asserts the caller's error by identity instead.Mutation checked: wrong code, unexpected code, missing code, nothing thrown, and a non
Errorall fail as they should.References
Checklist
no-changeloglabel.Note
Low Risk
Test-only changes to ApprovalController; no production code or runtime behavior changes.
Overview
ApprovalController tests now verify thrown errors’ messages and JSON-RPC
codevalues, not only messages via Jest’s plain-objecttoThrowmatching.getErrorreturns anExpectedErrordescriptor (message+ optionalcode), and a newexpectToThrowErrorhelper runs the operation once, catches the realError, and asserts both fields (includingcode === undefinedwhere no code is expected). Validation and “unknown id” cases acrossadd,getApprovalCount,hasRequest,acceptRequest,rejectRequest, andupdateRequestStatewere switched to this pattern.The
clearRequestsrejection test now usesrejects.toBe(rejectionError)so the propagatedJsonRpcErroris checked by identity (and thus code), not only message/class viarejects.toThrow.oxlint-suppressions.jsondrops related lint suppressions for this test file.Reviewed by Cursor Bugbot for commit bcbf6e0. Bugbot is set up for automated code reviews on this repo. Configure here.