Created
July 20, 2019 00:07
-
-
Save pinheadmz/6cc0238d8263b88d86bb87aa5f2a1788 to your computer and use it in GitHub Desktop.
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
it('should fund both wallets', async () => { | |
wdb.on('balance', (wallet, balance) => { | |
if (balance.confirmed === 2000 * 10 * 1e6) | |
wdb.emit(`balance trigger ${wallet.wid}`); | |
}); | |
const waitForBalance1 = new Promise( (resolve) => { | |
wdb.once('balance trigger 1', () => { | |
resolve(); | |
}); | |
}); | |
const waitForBalance2 = new Promise( (resolve) => { | |
wdb.once('balance trigger 2', () => { | |
resolve(); | |
}); | |
}); | |
await mineBlocks(10, ownerAddr); | |
await mineBlocks(10, buyerAddr); | |
await waitForBalance1; | |
await waitForBalance2; | |
const ownerBal = await owner.getBalance(); | |
const buyerBal = await owner.getBalance(); | |
assert(ownerBal.confirmed === 2000 * 10 * 1e6); | |
assert(buyerBal.confirmed === 2000 * 10 * 1e6); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment