Files
bch-js/test/integration/chains/testnet/control.js
T

33 lines
812 B
JavaScript
Raw Normal View History

2020-07-27 21:32:51 -07:00
/*
Integration tests for bchjs control library.
*/
import chai from 'chai'
import BCHJS from '../../../../src/bch-js.js'
2020-07-27 21:32:51 -07:00
const assert = chai.assert
const RESTURL = process.env.RESTURL
? process.env.RESTURL
: 'https://testnet3.fullstack.cash/v5/'
2020-07-27 21:32:51 -07:00
const bchjs = new BCHJS({ restURL: RESTURL, apiToken: process.env.BCHJSTOKEN })
2021-01-02 15:41:12 -08:00
describe('#control', () => {
beforeEach(async () => {
if (process.env.IS_USING_FREE_TIER) await sleep(1500)
})
2021-01-02 15:41:12 -08:00
describe('#getNetworkInfo', () => {
it('should get info on the full node', async () => {
2020-07-27 21:32:51 -07:00
const result = await bchjs.Control.getNetworkInfo()
console.log(`result: ${JSON.stringify(result, null, 2)}`)
2021-01-02 15:41:12 -08:00
assert.property(result, 'version')
2020-07-27 21:32:51 -07:00
})
})
})
2021-01-02 15:41:12 -08:00
function sleep (ms) {
return new Promise(resolve => setTimeout(resolve, ms))
}