dd9add50a0
* 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)
100 lines
3.8 KiB
JavaScript
100 lines
3.8 KiB
JavaScript
const assert = require('assert')
|
|
const axios = require('axios')
|
|
const { nativeToErcBridge, ercToErcBridge, ercToNativeBridge, validator } = require('../../e2e-commons/constants.json')
|
|
|
|
const types = [
|
|
{ description: 'NATIVE TO ERC', baseUrl: nativeToErcBridge.monitor },
|
|
{ description: 'ERC TO ERC', baseUrl: ercToErcBridge.monitor },
|
|
{ description: 'ERC TO NATIVE', baseUrl: ercToNativeBridge.monitor }
|
|
]
|
|
|
|
types.forEach(type => {
|
|
describe(type.description, () => {
|
|
describe('balances', async () => {
|
|
let data
|
|
|
|
before(async () => {
|
|
;({ data } = await axios.get(`${type.baseUrl}`))
|
|
})
|
|
|
|
describe('home', async () => {
|
|
it('should contain deposits:', () => assert(data.home.deposits === 0))
|
|
it('should contain withdrawals', () => assert(data.home.withdrawals === 0))
|
|
})
|
|
|
|
describe('foreign', async () => {
|
|
it('should contain deposits:', () => assert(data.foreign.deposits === 0))
|
|
it('should contain withdrawals', () => assert(data.foreign.withdrawals === 0))
|
|
})
|
|
|
|
describe('general', async () => {
|
|
it('should contain balanceDiff', () => assert(data.balanceDiff === 0))
|
|
it('should contain depositsDiff', () => assert(data.depositsDiff === 0))
|
|
it('should contain withdrawalDiff', () => assert(data.withdrawalDiff === 0))
|
|
it('should contain timeDiff', () => assert(data.timeDiff >= 0))
|
|
it('should contain lastChecked', () => assert(data.lastChecked >= 0))
|
|
})
|
|
})
|
|
|
|
describe('validators', async () => {
|
|
let data
|
|
|
|
before(async () => {
|
|
;({ data } = await axios.get(`${type.baseUrl}/validators`))
|
|
})
|
|
|
|
it('home', () => {
|
|
assert(typeof data.home.validators === 'object')
|
|
assert(data.home.validators[validator.address].balance > 0)
|
|
assert(data.home.validators[validator.address].leftTx > 0)
|
|
assert(data.home.validators[validator.address].gasPrice > 0)
|
|
})
|
|
|
|
it('foreign', () => {
|
|
assert(typeof data.foreign.validators === 'object')
|
|
assert(data.foreign.validators[validator.address].balance > 0)
|
|
assert(data.foreign.validators[validator.address].leftTx > 0)
|
|
assert(data.foreign.validators[validator.address].gasPrice > 0)
|
|
})
|
|
|
|
it('requiredSignaturesMatch', () => assert(data.requiredSignaturesMatch, 1))
|
|
it('validatorsMatch', () => assert(data.validatorsMatch))
|
|
it('lastChecked', () => assert(data.lastChecked >= 0))
|
|
it('timeDiff', () => assert(data.timeDiff >= 0))
|
|
it('homeOk', () => assert(data.homeOk))
|
|
it('foreignOk', () => assert(data.foreignOk))
|
|
it('ok', () => assert(data.ok))
|
|
})
|
|
|
|
describe('eventsStats', async () => {
|
|
let data
|
|
|
|
before(async () => {
|
|
;({ data } = await axios.get(`${type.baseUrl}/eventsStats`))
|
|
})
|
|
|
|
it('ok', () => assert(data.ok))
|
|
it('lastChecked', () => assert(data.lastChecked >= 0))
|
|
it('timeDiff', () => assert(data.timeDiff >= 0))
|
|
it('onlyInHomeDeposits', () => assert(typeof data.onlyInHomeDeposits === 'object'))
|
|
it('onlyInForeignDeposits', () => assert(typeof data.onlyInForeignDeposits === 'object'))
|
|
it('onlyInHomeWithdrawals', () => assert(typeof data.onlyInHomeWithdrawals === 'object'))
|
|
it('onlyInForeignWithdrawals', () => assert(typeof data.onlyInForeignWithdrawals === 'object'))
|
|
})
|
|
|
|
describe('alerts', async () => {
|
|
let data
|
|
|
|
before(async () => {
|
|
;({ data } = await axios.get(`${type.baseUrl}/alerts`))
|
|
})
|
|
|
|
it('ok', () => assert(data.ok))
|
|
it('lastChecked', () => assert(data.lastChecked >= 0))
|
|
it('timeDiff', () => assert(data.timeDiff >= 0))
|
|
it('executeSignatures', () => assert(typeof data.executeSignatures === 'object'))
|
|
it('executeAffirmations', () => assert(typeof data.executeAffirmations === 'object'))
|
|
})
|
|
})
|
|
})
|