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

fix: _handleChainChanged in MetaMaskInpageProvider to handle networkVersion #171

Merged
merged 3 commits into from
May 12, 2021

Conversation

shanejonas
Copy link
Contributor

  • adds tests for the 2 events chainChanged and networkChanged

@shanejonas shanejonas requested a review from a team as a code owner May 11, 2021 21:48
@shanejonas shanejonas force-pushed the fix/handleChainChanged branch from 8460206 to 71d7318 Compare May 11, 2021 21:48
@shanejonas shanejonas force-pushed the fix/handleChainChanged branch from 71d7318 to 5f0f0fc Compare May 11, 2021 21:50
Copy link
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

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

This looks like what we need. Great addition with the tests, as always!

Comment on lines 645 to 648
p.on('chainChanged', (changed) => {
expect(changed).toBe('0x1');
done();
});
Copy link
Member

Choose a reason for hiding this comment

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

We should avoid disabling jest/no-test-callback by removing the callback and wrapping these lines in a Promise and awaiting it at the end of the test. Similarly below.

src/MetaMaskInpageProvider.rpc.test.ts Show resolved Hide resolved
src/MetaMaskInpageProvider.ts Show resolved Hide resolved
src/BaseProvider.ts Outdated Show resolved Hide resolved
src/MetaMaskInpageProvider.ts Outdated Show resolved Hide resolved
src/MetaMaskInpageProvider.rpc.test.ts Outdated Show resolved Hide resolved
src/BaseProvider.rpc.test.ts Show resolved Hide resolved
Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>
@shanejonas shanejonas requested a review from rekmarks May 12, 2021 18:45
@shanejonas shanejonas force-pushed the fix/handleChainChanged branch 2 times, most recently from 71f708b to cdab561 Compare May 12, 2021 18:48
@shanejonas shanejonas force-pushed the fix/handleChainChanged branch from cdab561 to 7a7dafd Compare May 12, 2021 18:51
Copy link
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

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

LGTM!

@shanejonas shanejonas merged commit 87f33cf into main May 12, 2021
@shanejonas shanejonas deleted the fix/handleChainChanged branch May 12, 2021 19:33
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.

2 participants