Skip to content

Commit

Permalink
Merge pull request #804 from nodar-chkuaselidze/rpc-cleanup
Browse files Browse the repository at this point in the history
Minor RPC Test updates
  • Loading branch information
braydonf committed Jun 27, 2019
2 parents fb753a4 + c7605ac commit 4542ec5
Show file tree
Hide file tree
Showing 3 changed files with 277 additions and 295 deletions.
63 changes: 63 additions & 0 deletions test/node-rpc-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/* eslint-env mocha */
/* eslint prefer-arrow-callback: "off" */

'use strict';

const assert = require('bsert');
const FullNode = require('../lib/node/fullnode');

const ports = {
p2p: 49331,
node: 49332,
wallet: 49333
};

const node = new FullNode({
network: 'regtest',
apiKey: 'foo',
walletAuth: true,
memory: true,
workers: true,
workersSize: 2,
plugins: [require('../lib/wallet/plugin')],
port: ports.p2p,
httpPort: ports.node,
env: {
'BCOIN_WALLET_HTTP_PORT': ports.wallet.toString()
}});

const {NodeClient} = require('bclient');

const nclient = new NodeClient({
port: ports.node,
apiKey: 'foo',
timeout: 15000
});

describe('RPC', function() {
this.timeout(15000);

before(async () => {
await node.open();
});

after(async () => {
await node.close();
});

it('should rpc help', async () => {
assert(await nclient.execute('help', []));

await assert.rejects(async () => {
await nclient.execute('help', ['getinfo']);
}, {
name: 'Error',
message: /^getinfo/
});
});

it('should rpc getinfo', async () => {
const info = await nclient.execute('getinfo', []);
assert.strictEqual(info.blocks, 0);
});
});
280 changes: 0 additions & 280 deletions test/rpc-test.js

This file was deleted.

Loading

0 comments on commit 4542ec5

Please sign in to comment.