UNPKG

@haechi-labs/henesis-cli

Version:

🚀 Command Line Interface tool to Utilize henesis

74 lines (73 loc) • 2.04 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); const test_1 = require('@oclif/test'); process.env.HENESIS_TEST = 'true'; describe('node:status', () => { context('when no error occurred', () => { test_1.test .nock('http://network.henesis.io', api => api .post('/ethereum/mainnet') .reply(200, { result: false }) .post('/ethereum/ropsten') .reply(200, { result: false }) .post('/ethereum/rinkeby') .reply(200, { result: false }) .post('/klaytn/mainnet') .reply(200, { result: false }) .post('/klaytn/baobab') .reply(200, { result: false }), ) .stdout() .command(`node:status`) .it('all synced', ctx => { const rows = ctx.stdout .trim() .split('\n') .slice(1); rows.forEach(row => { test_1 .expect( row .trim() .split(/\s+/) .slice(-1)[0], ) .to.equal('Synced'); }); }); }); context('when some nodes are down', () => { test_1.test .nock('http://network.henesis.io', api => api .post('/ethereum/mainnet') .reply(200, { result: false }) .post('/ethereum/ropsten') .reply(200, { result: false }) .post('/ethereum/rinkeby') .reply(200, { result: false }) .post('/klaytn/mainnet') .reply(200, { result: false }) .post('/klaytn/baobab') .reply(500), ) .stdout() .command(`node:status`) .it('last node would be down', ctx => { const rows = ctx.stdout .trim() .split('\n') .slice(1); test_1 .expect( rows .slice(-1)[0] .split(/\s+/) .slice(-1)[0], ) .to.equal('Down'); }); }); }); //# sourceMappingURL=status.spec.js.map