Skip to content

test: add demo page smoke tests (Tier 5)#419

Merged
gabitoesmiapodo merged 3 commits intotest/utilsfrom
test/demo-smoke
Mar 25, 2026
Merged

test: add demo page smoke tests (Tier 5)#419
gabitoesmiapodo merged 3 commits intotest/utilsfrom
test/demo-smoke

Conversation

@gabitoesmiapodo
Copy link
Collaborator

Summary

  • Smoke tests for all demo page components (ConnectWallet, EnsName, HashHandling, SignMessage, SwitchNetwork, TransactionButton, TokenDropdown, TokenInput)
  • Smoke tests for NotFound404 and home page index
  • All Web3/wagmi hooks mocked at module level; no real wallet or network interaction

Test plan

  • pnpm test passes on this branch
  • Each demo verifies it renders without crashing
  • Components using withSuspenseAndRetry wrapped in QueryClientProvider in test setup

Copilot AI review requested due to automatic review settings March 23, 2026 21:18
@vercel
Copy link

vercel bot commented Mar 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
components.dappbooster Ready Ready Preview, Comment Mar 24, 2026 0:04am
demo.dappbooster Ready Ready Preview, Comment Mar 24, 2026 0:04am
docs.dappbooster Ready Ready Preview, Comment Mar 24, 2026 0:04am

Request Review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds Tier 5 smoke tests to ensure the home page, 404 page, and several demo components render without crashing by mocking Web3/wagmi dependencies at the module level.

Changes:

  • Added smoke test for the Home page rendering its main sections.
  • Added smoke tests for multiple demo components (ConnectWallet, EnsName, HashHandling, SignMessage, SwitchNetwork, TransactionButton, TokenDropdown, TokenInput).
  • Added smoke test for the NotFound404 page.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/components/pageComponents/home/index.test.tsx Smoke test that Home renders Welcome + Examples (mocked).
src/components/pageComponents/home/Examples/demos/TransactionButton/index.test.tsx Smoke test for TransactionButton demo with Web3 status + ConnectWalletButton mocked.
src/components/pageComponents/home/Examples/demos/TokenInput/index.test.tsx Smoke test for TokenInput demo using QueryClientProvider and mocked token hooks.
src/components/pageComponents/home/Examples/demos/TokenDropdown/index.test.tsx Smoke test for TokenDropdown demo with shared TokenDropdown mocked.
src/components/pageComponents/home/Examples/demos/SwitchNetwork/index.test.tsx Smoke test for SwitchNetwork demo showing Connect Wallet fallback.
src/components/pageComponents/home/Examples/demos/SignMessage/index.test.tsx Smoke test for SignMessage demo showing Connect Wallet fallback.
src/components/pageComponents/home/Examples/demos/HashHandling/index.test.tsx Smoke test for HashHandling demo with hash detection mocked.
src/components/pageComponents/home/Examples/demos/EnsName/index.test.tsx Smoke test for EnsName demo with wagmi useEnsName mocked.
src/components/pageComponents/home/Examples/demos/ConnectWallet/index.test.tsx Smoke test for ConnectWallet demo with ConnectWalletButton mocked.
src/components/pageComponents/NotFound404.test.tsx Smoke test for NotFound404 rendering title and Home button with router navigation mocked.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

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 10 out of 10 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Smoke tests for all demo page components to verify they render
without crashing. Mocks external Web3 deps at module level.

New test files:
- home/index.test.tsx: Home renders Welcome + Examples sections
- NotFound404.test.tsx: 404 page with mocked useNavigate
- demos/ConnectWallet/index.test.tsx: mocked ConnectWalletButton
- demos/EnsName/index.test.tsx: mocked useEnsName
- demos/HashHandling/index.test.tsx: mocked useWeb3Status + detectHash
- demos/SignMessage/index.test.tsx: shows fallback when wallet absent
- demos/SwitchNetwork/index.test.tsx: shows fallback when wallet absent
- demos/TransactionButton/index.test.tsx: shows fallback when wallet absent
- demos/TokenDropdown/index.test.tsx: mocked BaseTokenDropdown
- demos/TokenInput/index.test.tsx: mocked useTokenLists + useTokenSearch

Also adds .env.test and src/test-utils.tsx (shared test utilities).
The module exports detectHash as a default export; the mock only provided
a named export so HashInput would receive undefined and throw on invocation.
Added both default and named exports to the mock factory.
- home/index.test.tsx: use renderWithProviders from test-utils
- TransactionButton demo: use createMockWeb3Status for complete hook shape
- TokenInput demo: fix useTokenInput mock to match the real hook return
  (amount/setAmount/amountError/balance/isLoadingBalance/selectedToken/setTokenSelected)
  and use renderWithProviders + createMockWeb3Status helpers
Base automatically changed from test/components to test/utils March 25, 2026 18:49
@gabitoesmiapodo gabitoesmiapodo merged commit cb38783 into test/utils Mar 25, 2026
6 checks passed
@gabitoesmiapodo gabitoesmiapodo deleted the test/demo-smoke branch March 25, 2026 18:49
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.

3 participants