-
Notifications
You must be signed in to change notification settings - Fork 39
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
[TEST] Network simulator and some initial tests #364
Conversation
✅ Deploy Preview for cheery-moxie-4f1121 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
new tests will fail until #363 is merged (which will solve the sync bug) |
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.
These looks good, my only nit is that these are no longer unit tests, so just move them in a different folder
done |
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.
ACK nice tests
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.
tACK 899e48a
Abstract
The aim of this PR is improving the unit test coverage by adding a mock to the network class.
How to use it in unit tests:
vi.mock('../../../scripts/network.js')
setUpLegacyMainnetWallet()
. Those wallets have a non-zero balance and are synced.getNetwork().sendTransaction(txHex)
getNetwork().mintBlock()
refreshChainData();
Notice that calling
refreshChainData()
will emit a signal that is received by wallets aswhich makes tests reliable, in the sense that the normal sync flow is followed, with the only difference that instead of blockbook, blocks are provided by the mock class.
I have also added a couple of tests:
MAX_ACCOUNT_GAP
addresses after the last usedTesting
Tests working as expected