test: add fast, isolated unit coverage for freezeOrderComponents - #957
Merged
ryanio merged 1 commit intoAug 14, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #957 +/- ##
==========================================
+ Coverage 98.27% 98.85% +0.57%
==========================================
Files 35 45 +10
Lines 14526 17579 +3053
Branches 660 897 +237
==========================================
+ Hits 14276 17378 +3102
+ Misses 245 194 -51
- Partials 5 7 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
test: add fast, isolated unit coverage for
freezeOrderComponentsMotivation
freezeOrderComponents(added recently to guarantee theorderComponentsexposed on a create action can't drift from what actually gets signed — see
its JSDoc in
src/utils/order.ts) currently only has indirect coveragethrough
test/execute-approvals.spec.ts, which needs the full Hardhatnetwork (contract deployment, a signer, etc.) to run.
That's appropriate for testing the end-to-end feature, but the freezing
logic itself is a pure function with no on-chain dependency, and it's a
mutation-safety guarantee the JSDoc goes out of its way to explain the
reasoning for — exactly the kind of thing worth pinning down with a fast,
isolated unit test that runs in milliseconds and fails with a precise
message if the freezing behavior ever regresses.
What this adds
A
freezeOrderComponentsdescribe block intest/utils/order.spec.ts(alongside the existing
deductFeessuite, since both live insrc/utils/order.ts), covering:explicit that this is intentional, not an oversight).
OrderComponentsobject.offeritems individually, not just the array wrapper.considerationitems individually, and that the arrayitself rejects mutation (e.g.
push).(the
Object.isFrozenshort-circuit indeepFreeze).Testing
npx tsc --noEmit— clean.npx biome check test/utils/order.spec.ts— clean.deductFeescases + 5 new
freezeOrderComponentscases), all in single-digitmilliseconds since none of it touches the network.
Scope
Test-only change, one file. No production code touched.