Skip to content

Conversation

@joaquim-verges
Copy link
Member

@joaquim-verges joaquim-verges commented Dec 11, 2024

Problem solved

Short description of the bug fixed or feature added


PR-Codex overview

This PR introduces a MockStorage class for testing and updates various hooks related to wallet management in the thirdweb library. It enhances test coverage by implementing mock storage functionality and ensuring proper error handling in wallet connection scenarios.

Detailed summary

  • Added MockStorage class in storage.ts to simulate storage operations.
  • Updated useSetActiveWallet, useAddConnectedWallet, and useConnect tests to use MockStorage.
  • Improved error handling and validation for hooks when not used within <ThirdwebProvider>.
  • Enhanced tests to verify wallet connection and management functionality.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@vercel
Copy link

vercel bot commented Dec 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 11, 2024 7:59am
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 11, 2024 7:59am
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 11, 2024 7:59am
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 11, 2024 7:59am

@changeset-bot
Copy link

changeset-bot bot commented Dec 11, 2024

⚠️ No Changeset found

Latest commit: c620497

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@graphite-app
Copy link
Contributor

graphite-app bot commented Dec 11, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “merge-queue” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

@joaquim-verges joaquim-verges marked this pull request as ready for review December 11, 2024 07:49
@github-actions github-actions bot added packages SDK Involves changes to the thirdweb SDK labels Dec 11, 2024
Copy link
Member Author

joaquim-verges commented Dec 11, 2024


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

import { useActiveWalletConnectionStatus } from "./useActiveWalletConnectionStatus.js";
import { useConnect } from "./useConnect.js";

describe("useAddConnectedWallet", () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

The describe block title should be useConnect to match the hook under test. The current title useAddConnectedWallet appears to be a copy/paste error.

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

@github-actions
Copy link
Contributor

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 44.93 KB (0%) 899 ms (0%) 3.9 s (+70.16% 🔺) 4.8 s
thirdweb (cjs) 110.71 KB (0%) 2.3 s (0%) 6.8 s (+12.78% 🔺) 9 s
thirdweb (minimal + tree-shaking) 5.58 KB (0%) 112 ms (0%) 182 ms (-19.83% 🔽) 294 ms
thirdweb/chains (tree-shaking) 506 B (0%) 10 ms (0%) 124 ms (-21.6% 🔽) 134 ms
thirdweb/react (minimal + tree-shaking) 19.07 KB (0%) 382 ms (0%) 829 ms (+10.53% 🔺) 1.3 s

@codecov
Copy link

codecov bot commented Dec 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 51.29%. Comparing base (da5d8ec) to head (c620497).
Report is 40 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5689      +/-   ##
==========================================
+ Coverage   51.26%   51.29%   +0.02%     
==========================================
  Files        1092     1092              
  Lines       57375    57375              
  Branches     4691     4692       +1     
==========================================
+ Hits        29416    29431      +15     
+ Misses      27243    27228      -15     
  Partials      716      716              
Flag Coverage Δ *Carryforward flag
legacy_packages 65.68% <ø> (ø) Carriedforward from da5d8ec
packages 47.92% <ø> (+0.03%) ⬆️

*This pull request uses carry forward flags. Click here to find out more.

see 7 files with indirect coverage changes

@joaquim-verges joaquim-verges merged commit 77c8d0e into main Dec 13, 2024
32 of 34 checks passed
@joaquim-verges joaquim-verges deleted the test_Add_wallet_connection_hook_tests branch December 13, 2024 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packages SDK Involves changes to the thirdweb SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants