-
-
Notifications
You must be signed in to change notification settings - Fork 10
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 a condition in the "wipeSmartTransations" function #323
Conversation
}); | ||
}); | ||
|
||
it('removes transactions from current chainId if ignoreNetwork is false', () => { |
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.
Perhaps also a case for does not remove transaction from unrelated chainId if ignoreNetwork is true
?
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.
In the test removes transactions from current chainId if ignoreNetwork is false
I check if transactions were removed from one chain but not from another one. I've updated a title for that test to make it little clearer.
If ignoreNetwork
is true, we want to remove it from all chainIds and for that I already have a test.
@@ -1415,12 +1415,29 @@ describe('SmartTransactionsController', () => { | |||
expect(smartTransactionsController.state).toStrictEqual(prevState); | |||
}); | |||
|
|||
it('removes transactions from current chainId if ignoreNetwork is true', () => { | |||
it('removes transactions from all supported chainIds if ignoreNetwork is true', () => { |
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.
Should there also be test(s) for current behavior for unsupported chainIds?
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.
I've renamed this test to removes transactions from all chains saved in the smartTransactionsState if ignoreNetwork is true
to make it clear that we don't care about the supportedChainIds
list in this function.
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.
I think I'd still like to see test-coverage for the following cases:
- user is on supported network A
- user submits smart transaction
- user changes network to not supported network B, retaining their existing smart transaction on network A
- user calls
wipeSmartTransactions
a. ...withignoreNetwork: false
- this will ignore the submitted tx and leave it unmodified. this should be covered.
b. ...withignoreNetwork: true
- seems obvious that this should wipe all txs regardless, but still be nice to test this for the sake of regressions.
89c3d6d
to
5b42457
Compare
Description
Fix a condition in the "wipeSmartTransations" function, update tests.