tokenbridge/monitor-e2e/test/nativeToErc.js
Przemyslaw Rzad dd9add50a0
Monitor E2E rewrite (#187)
* Started monitor-e2e rewrite

* axios

* Implemented tests

* Monitor start

* First deploy

* Wait for monitor

* Removed redundant files

* Tests.

* TODO

* Links to minitor in constants

* Typo.

* [PR-into-PR] Monitor E2E rewrite - balance (#191)

* Test run for more monitor-e2e tests

* macos/docker

* timeout

* Little refactor

* Trying to test balances in other types of bridges.

* Utils.

* test

* check all

* erc to erc try

* Final tests

* typo

* All jobs

* Lint

* Roll back docker in docker

* WaitUntil

* Axios version

* New validator checks (#192)
2019-08-27 16:26:49 +02:00

44 lines
1.3 KiB
JavaScript

const assert = require('assert')
const axios = require('axios')
const { nativeToErcBridge, user, homeRPC, foreignRPC, validator } = require('../../e2e-commons/constants.json')
const { waitUntil, sendEther, addValidator } = require('../utils')
const baseUrl = nativeToErcBridge.monitor
describe('NATIVE TO ERC', () => {
let data
before(async () => {
;({ data } = await axios.get(`${baseUrl}`))
})
it('balance', () => assert(parseInt(data.home.balance, 10) >= 0))
it('should contain totalSupply', () => assert(data.foreign.totalSupply === '0'))
})
describe('NATIVE TO ERC with changing state of contracts', () => {
let data
before(async () => {
assert((await axios.get(`${baseUrl}`)).data.balanceDiff === 0)
assert((await axios.get(`${baseUrl}/validators`)).data.validatorsMatch === true)
})
it('should change balanceDiff', async () => {
await sendEther(homeRPC.URL, user, nativeToErcBridge.home)
await waitUntil(async () => {
;({ data } = await axios.get(`${baseUrl}`))
return data.balanceDiff !== 0
})
})
it('should change validatorsMatch', async () => {
await addValidator(foreignRPC.URL, validator, nativeToErcBridge.foreign)
await waitUntil(async () => {
;({ data } = await axios.get(`${baseUrl}/validators`))
return data.validatorsMatch === false
})
})
})