Skip to content

test(maturity): cover disburse-maturity address-book routing#412

Open
yhabib wants to merge 2 commits into
mainfrom
test/disburse-maturity-address-book
Open

test(maturity): cover disburse-maturity address-book routing#412
yhabib wants to merge 2 commits into
mainfrom
test/disburse-maturity-address-book

Conversation

@yhabib

@yhabib yhabib commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

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

  • Added hook tests for useDisburseMaturity checking that an ICP destination calls disburseMaturity with toAccountIdentifier (and no toAccount), while an ICRC-1 destination sends the structured toAccount (subaccount as number[] or undefined) and no toAccountIdentifier.
  • Covered the 32-byte subaccount guard: a non-32-byte subaccount is treated as the default subaccount both in the forwarded destination and in the derived account id used for balance invalidation.
  • Added modal tests for DisburseMaturityModal: the noDestination error 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.

Copilot AI review requested due to automatic review settings July 1, 2026 12:54
@yhabib yhabib requested a review from a team as a code owner July 1, 2026 12:54
@zeropath-ai

zeropath-ai Bot commented Jul 1, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to f4fb1ab.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► src/governance-app-frontend/src/features/stakes/components/DisburseMaturityModal.test.tsx
    Add tests for DisburseMaturityModal UI behaviors and interactions
► src/governance-app-frontend/src/features/stakes/hooks/useDisburseMaturity.test.tsx
    Add tests for useDisburseMaturity hook behavior, ICP destination handling, and ICRC-1 destination handling

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

📊 Build Bundle Stats

The latest build generated the following assets:

dist/index.html                                           2.39 kB │ gzip:   0.84 kB
dist/assets/index-T44C8lYV.css                          131.52 kB │ gzip:  21.41 kB
dist/assets/externalServices-CK4eoRia.js                  0.19 kB │ gzip:   0.16 kB
dist/assets/address-C-4H442a.js                           0.20 kB │ gzip:   0.15 kB
dist/assets/Skeleton-Bgoxabxt.js                          0.46 kB │ gzip:   0.34 kB
dist/assets/useTvlValue-BppcdVAv.js                       0.57 kB │ gzip:   0.39 kB
dist/assets/numbers-B9oiH86s.js                           0.58 kB │ gzip:   0.36 kB
dist/assets/service-DxqNxKjV.js                           0.59 kB │ gzip:   0.38 kB
dist/assets/Spinner-CZi6lS8l.js                           0.59 kB │ gzip:   0.41 kB
dist/assets/PageHeader-Czh9Jiub.js                        0.77 kB │ gzip:   0.45 kB
dist/assets/CertifiedBadge-C-pdx5aQ.js                    0.81 kB │ gzip:   0.48 kB
dist/assets/Separator-dFULeHAY.js                         0.83 kB │ gzip:   0.49 kB
dist/assets/useIcpIndex-BMwPyLlv.js                       1.07 kB │ gzip:   0.63 kB
dist/assets/rolldown-runtime-CMxvf4Kt.js                  1.21 kB │ gzip:   0.67 kB
dist/assets/addressBook-_uX5bf_n.js                       1.66 kB │ gzip:   0.99 kB
dist/assets/useCommandPaletteSettings-Bpv5rVbB.js         1.73 kB │ gzip:   0.86 kB
dist/assets/useGovernanceAppCanister-CoqvN6mv.js          1.91 kB │ gzip:   0.96 kB
dist/assets/AnimatedNumber-DEESajkh.js                    1.96 kB │ gzip:   1.12 kB
dist/assets/useIcpIndexTransactionsPolling-DWMfUIEX.js    2.03 kB │ gzip:   1.10 kB
dist/assets/EmptyActionState-CQGpSIEp.js                  2.52 kB │ gzip:   1.12 kB
dist/assets/ToggleGroup-x6fCHMXt.js                       3.09 kB │ gzip:   1.40 kB
dist/assets/tickers-B3hd-_mC.js                           3.10 kB │ gzip:   1.48 kB
dist/assets/Switch-DrR8z4ce.js                            3.22 kB │ gzip:   1.44 kB
dist/assets/SensitiveValue-B0dcYUbm.js                    7.33 kB │ gzip:   3.29 kB
dist/assets/routes-DWJdGr0R.js                            7.48 kB │ gzip:   2.46 kB
dist/assets/badge-sqv279MO.js                             8.12 kB │ gzip:   2.36 kB
dist/assets/spamFilter-BNy7yDeo.js                        8.54 kB │ gzip:   3.80 kB
dist/assets/TopicFollowingAccordion-DKEwlLWr.js           9.34 kB │ gzip:   3.81 kB
dist/assets/MutationDialog-BN8Tf_Ir.js                    9.52 kB │ gzip:   3.42 kB
dist/assets/_id-DMsYr0y7.js                              14.33 kB │ gzip:   4.30 kB
dist/assets/_auth-U1lLVdgw.js                            15.56 kB │ gzip:   5.72 kB
dist/assets/accounts-Df8oFLJG.js                         23.71 kB │ gzip:   8.17 kB
dist/assets/GetTokens-BB_ypk-7.js                        39.29 kB │ gzip:  14.02 kB
dist/assets/settings-CDvbQJLp.js                         42.47 kB │ gzip:  12.20 kB
dist/assets/dashboard-C9tsQotw.js                        51.05 kB │ gzip:  15.11 kB
dist/assets/button-Cd45O-27.js                           53.56 kB │ gzip:  18.71 kB
dist/assets/neurons-DruHkl5s.js                          66.03 kB │ gzip:  19.84 kB
dist/assets/voting-BMCQ6JwE.js                           69.22 kB │ gzip:  21.15 kB
dist/assets/neuronDetail-x7Pe1kk7.js                     70.25 kB │ gzip:  21.01 kB
dist/assets/vendor-md-DL0JfF_R.js                        73.29 kB │ gzip:  19.98 kB
dist/assets/index-CgZ4T4H_.js                            73.49 kB │ gzip:  22.83 kB
dist/assets/vendor-tanstack-BZKtD_S5.js                 161.15 kB │ gzip:  49.35 kB
dist/assets/vendor-core-react-qLCIanUQ.js               189.81 kB │ gzip:  59.76 kB
dist/assets/vendor-recharts-Ck18_gYq.js                 223.45 kB │ gzip:  64.01 kB
dist/assets/vendor-icp-DP4ARddz.js                      411.37 kB │ gzip: 104.08 kB
dist/assets/vendor-libs-B2aYRUFu.js                     553.60 kB │ gzip: 180.31 kB

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 useDisburseMaturity hook tests validating ICP vs ICRC-1 routing (toAccountIdentifier vs structured toAccount) 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 DisburseMaturityModal tests 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@yhabib yhabib force-pushed the test/disburse-maturity-address-book branch from 4601acd to f4fb1ab Compare July 7, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants