Skip to content

test(keys): add unit tests for vote modal option index and submission… - #270

Open
FrankHood1 wants to merge 1 commit into
StellarState:devfrom
FrankHood1:test/vote-modal-unit-tests
Open

test(keys): add unit tests for vote modal option index and submission…#270
FrankHood1 wants to merge 1 commit into
StellarState:devfrom
FrankHood1:test/vote-modal-unit-tests

Conversation

@FrankHood1

Copy link
Copy Markdown

Summary

Adds unit tests for the vote modal asserting the correct option index is submitted and the controls disable appropriately after voting.

Acceptance Criteria Covered

  • Correct option index passed to the contract on submission (0 and 1)
  • Confirm disabled until an option is selected
  • Confirm enabled once an option is selected
  • Vote button (Confirm) disabled and "Vote recorded" shown after a successful submission
  • Error message shown on contract failure
  • Confirm button re-enabled on failure

Changes

  • components/keys/__tests__/VoteModal.test.tsx — new unit test suite for VoteModal
  • components/keys/VoteModal.tsx — wrap handleSubmit in try/catch so a failed contract call no longer produces an unhandled rejection, and render an in-modal error message on failure via the mutation error state

Verification

  • npx vitest run components/keys/__tests__/VoteModal.test.tsx — 6/6 tests pass
  • eslint clean on changed files
  • No new type errors introduced

Closes #96
Closes #98
Closes #114
Closes #117

… states

Add unit tests covering the VoteModal acceptance criteria:
- Correct option index passed to the contract for each selectable option
- Confirm button disabled until an option is selected
- Confirm button disabled and 'Vote recorded' shown after a successful vote
- Error message shown on contract failure and Confirm re-enabled

Also fix VoteModal handleSubmit to catch mutation rejections and render an
in-modal error message on contract failure.
@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@FrankHood1 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment