Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create test for useWallet #180

Merged
merged 3 commits into from
Dec 27, 2021
Merged

Conversation

gjsyme
Copy link
Contributor

@gjsyme gjsyme commented Dec 26, 2021

Closes #176

Description

Add @testing-library/react-hooks, make use of Provider for context and test that useWallet can instantiate and trigger the request to connect to the correct network.

📝 Additional Information

Anything else you'd want reviewers to know.

Pretty basic tests, but extensible if we want to either deeply mock window.ethereum, make use of another external library (though none jump out as best-choice), or solve this in another way.

Add @testing-library/react-hooks, make use of Provider for context and
test that useWallet can instantiate and trigger the request to connect
to the correct network.
@changeset-bot
Copy link

changeset-bot bot commented Dec 26, 2021

⚠️ No Changeset found

Latest commit: e79b399

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

Improve readability of the tests and their output
@etr2460
Copy link
Contributor

etr2460 commented Dec 27, 2021

The chromatic run failed because this PR is made from a fork. If you want to, then you could re open the PR from a branch in the repo. that said, since it's only a test, i feel like it would be safe without chromatic running

Copy link
Contributor

@etr2460 etr2460 left a comment

Choose a reason for hiding this comment

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

a few comments but mostly good. thanks for adding tests!

packages/hooks/src/hooks/useWallet.test.tsx Outdated Show resolved Hide resolved
packages/hooks/src/hooks/useWallet.test.tsx Outdated Show resolved Hide resolved
packages/hooks/src/hooks/useWallet.test.tsx Outdated Show resolved Hide resolved
Addresses feedback on the PR. Also adddresses (in comment) the fact that
we are not handling high number networks in hex, which is what comments
in the code of useWallet call for
Copy link
Contributor

@etr2460 etr2460 left a comment

Choose a reason for hiding this comment

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

let's do it, thanks for the tests!

@etr2460 etr2460 merged commit c4556d9 into Developer-DAO:main Dec 27, 2021
@etr2460
Copy link
Contributor

etr2460 commented Dec 27, 2021

@allcontributors add @gjsyme for code

@allcontributors
Copy link
Contributor

@etr2460

I've put up a pull request to add @gjsyme! 🎉

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.

Add tests for useWallet
2 participants