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

Add tests for KeyringController edge cases #3847

Merged
merged 3 commits into from
Jan 26, 2024
Merged

Conversation

mikesposito
Copy link
Member

@mikesposito mikesposito commented Jan 25, 2024

Explanation

This PR adds additional tests for edge cases, useful for #3830.
Some istanbul ignore if statements are also being removed

References

Changelog

No functional changes

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate

@mikesposito mikesposito requested a review from a team as a code owner January 25, 2024 16:08
@mikesposito mikesposito changed the title Add test coverage Add tests for KeyringController edge cases Jan 25, 2024
@mikesposito mikesposito force-pushed the test/keyring-edge-cases branch from 4283c8c to 16652dc Compare January 25, 2024 19:39
Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

Looks good!

@@ -2762,7 +3036,9 @@ type WithControllerCallback<ReturnValue> = ({
messenger: KeyringControllerMessenger;
}) => Promise<ReturnValue> | ReturnValue;

type WithControllerOptions = Partial<KeyringControllerOptions>;
type WithControllerOptions = Partial<KeyringControllerOptions> & {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Something I've started doing in other test files when it comes to withController (or other similar helpers, like setupController) is splitting off controller options from other kinds of options. So withController could take an options object, but the controller options could be bundled into an options object, and then any other setup configuration you want to make could be done in other options. Essentially that turns this type into:

type WithControllerOptions = {
  options: Partial<KeyringControllerOptions>;
  skipVaultCreation?: boolean;
}

I realize that this would require a change across the board, but something to think about perhaps for a future PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea, I do think it would improve readability! I will do that in another PR

@mikesposito mikesposito force-pushed the test/keyring-edge-cases branch from 16652dc to 26bf1dc Compare January 26, 2024 09:15
@mikesposito mikesposito merged commit 79ebb87 into main Jan 26, 2024
136 checks passed
@mikesposito mikesposito deleted the test/keyring-edge-cases branch January 26, 2024 09:18
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.

Bump KeyringController test coverage to 100%
2 participants