-
Notifications
You must be signed in to change notification settings - Fork 813
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #804 from nodar-chkuaselidze/rpc-cleanup
Minor RPC Test updates
- Loading branch information
Showing
3 changed files
with
277 additions
and
295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.