test(maturity): cover disburse-maturity address-book routing#412
Open
yhabib wants to merge 2 commits into
Open
test(maturity): cover disburse-maturity address-book routing#412yhabib wants to merge 2 commits into
yhabib wants to merge 2 commits into
Conversation
|
✅ No security or compliance issues detected. Reviewed everything up to f4fb1ab. Security Overview
Detected Code Changes
|
📊 Build Bundle StatsThe latest build generated the following assets: |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds automated tests to prevent regressions in the newly introduced “disburse maturity to address-book destination” routing behavior, covering both the hook that issues the governance canister call and the modal UI wiring that selects/validates destinations.
Changes:
- Added
useDisburseMaturityhook tests validating ICP vs ICRC-1 routing (toAccountIdentifiervs structuredtoAccount) and query invalidation behavior. - Added coverage for the ICRC-1 “subaccount must be 32 bytes” normalization and its impact on both forwarded destination and balance invalidation key.
- Added
DisburseMaturityModaltests for address-book toggle validation, main-account read-only rendering when subaccounts are disabled, and disabling Disburse while the address book query is loading.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/governance-app-frontend/src/features/stakes/hooks/useDisburseMaturity.test.tsx | New hook tests for destination routing + balance invalidation, including subaccount normalization guard. |
| src/governance-app-frontend/src/features/stakes/components/DisburseMaturityModal.test.tsx | New modal tests for address-book routing/validation and loading-state button disabling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4601acd to
f4fb1ab
Compare
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.
Motivation
PR #395 added the option to disburse maturity to an address book entry, but the hook and modal that route the destination were not covered by tests. These behaviors are easy to break silently, so add tests to lock them in.
Changes
useDisburseMaturitychecking that an ICP destination callsdisburseMaturitywithtoAccountIdentifier(and notoAccount), while an ICRC-1 destination sends the structuredtoAccount(subaccount asnumber[]orundefined) and notoAccountIdentifier.DisburseMaturityModal: thenoDestinationerror shows when the address book is on but no entry is picked, the read-only main-account field shows when the address book is off and subaccounts are disabled, and the Disburse button is disabled while the address book query is loading.