eth-to-bnc-bridge/tests/test/bncToEth.js

32 lines
938 B
JavaScript
Raw Permalink Normal View History

2019-11-03 10:00:15 -08:00
const { waitPromise } = require('./utils/wait')
const { controller1 } = require('./utils/proxyController')
2019-11-03 10:00:15 -08:00
module.exports = (getUsers) => {
describe('exchange of tokens in bnc => eth direction', function () {
let users
let info
let ethBalances
before(async function () {
2019-11-03 10:00:15 -08:00
users = getUsers()
info = await controller1.getInfo()
2019-11-03 10:00:15 -08:00
ethBalances = await Promise.all(users.map((user) => user.getErcBalance()))
2019-11-03 10:00:15 -08:00
await Promise.all(users.map((user, i) => user.exchangeBep(info.foreignBridgeAddress, 3 + i)))
})
2019-11-01 11:43:25 -07:00
it('should make correct exchange transactions on eth side', async function () {
2019-11-18 08:57:16 -08:00
this.timeout(120000)
2019-11-01 11:43:25 -07:00
for (let i = 0; i < 3; i += 1) {
2019-11-03 10:00:15 -08:00
const user = users[i]
await waitPromise(
user.getErcBalance,
// eslint-disable-next-line no-loop-func
(newEthBalance) => newEthBalance === ethBalances[i] + 3 + i
)
}
})
})
}