This repository has been archived by the owner on Nov 9, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 62
Migrate to Jest #102
Merged
Migrate to Jest #102
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rekmarks
force-pushed
the
standardize-repository
branch
from
April 8, 2022 17:11
9bca929
to
ac87a75
Compare
mcmire
reviewed
Apr 8, 2022
@mcmire I converted all function keyword functions to arrow functions in the test files. I'm surprised our lint config didn't yell at me about that 🤔 |
rekmarks
commented
May 8, 2022
`Reflect` doesn't have that method. It only works because the property access walks the prototype chain back to `Object`.
mcmire
approved these changes
May 9, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this. This looks good to me. There's obviously more we can do to improve the test suite as I'm sure we are aware, but this is good on its own.
rekmarks
added a commit
to MetaMask/utils
that referenced
this pull request
May 16, 2022
`json-rpc-engine` recently added some generic JSON utils. This PR copies them to this package so that they can be deleted from `json-rpc-engine`. The tests and utilities are copied over exactly as they were implemented in MetaMask/json-rpc-engine#102.
mcmire
pushed a commit
to mcmire/core
that referenced
this pull request
Jul 17, 2023
`json-rpc-engine` recently added some generic JSON utils. This PR copies them to this package so that they can be deleted from `json-rpc-engine`. The tests and utilities are copied over exactly as they were implemented in MetaMask/json-rpc-engine#102.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Migrates all tests to Jest and TypeScript per the module template. Care was taken to modify the existing tests as little as possible. Therefore, the tests unfortunately make prodigious use of casts to
any
. Nevertheless, to minimize such casts, a pair of assertion type guards were added for successful and failed JSON-RPC responses. They use the existing boolean type guards under the hood, and are fully tested.Assertion type guards are tremendously helpful in situations like this, where boolean type guards don't help since e.g.
expect(typeGuard(value)).toBe(true);
doesn't tell TypeScript anything, and we have lint rules preventing us from callingexpect
conditionally.