Add JS tests for parity_netPeers
This commit is contained in:
parent
869fbf5108
commit
7cac50601f
@ -147,10 +147,50 @@ describe('api/format/output', () => {
|
|||||||
|
|
||||||
describe('outPeers', () => {
|
describe('outPeers', () => {
|
||||||
it('converts all internal numbers to BigNumbers', () => {
|
it('converts all internal numbers to BigNumbers', () => {
|
||||||
expect(outPeers({ active: 789, connected: '456', max: 0x7b })).to.deep.equal({
|
expect(outPeers({
|
||||||
|
active: 789,
|
||||||
|
connected: '456',
|
||||||
|
max: 0x7b,
|
||||||
|
peers: [
|
||||||
|
{
|
||||||
|
caps: ["par/1"],
|
||||||
|
id: "0x01",
|
||||||
|
name: "Parity",
|
||||||
|
network: {
|
||||||
|
localAddress: "10.0.0.1",
|
||||||
|
remoteAddress: "10.0.0.1"
|
||||||
|
},
|
||||||
|
protocols: {
|
||||||
|
par: {
|
||||||
|
difficulty: "0x0f",
|
||||||
|
head: "0x02",
|
||||||
|
version: 63
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})).to.deep.equal({
|
||||||
active: new BigNumber(789),
|
active: new BigNumber(789),
|
||||||
connected: new BigNumber(456),
|
connected: new BigNumber(456),
|
||||||
max: new BigNumber(123)
|
max: new BigNumber(123),
|
||||||
|
peers: [
|
||||||
|
{
|
||||||
|
caps: ["par/1"],
|
||||||
|
id: "0x01",
|
||||||
|
name: "Parity",
|
||||||
|
network: {
|
||||||
|
localAddress: "10.0.0.1",
|
||||||
|
remoteAddress: "10.0.0.1"
|
||||||
|
},
|
||||||
|
protocols: {
|
||||||
|
par: {
|
||||||
|
difficulty: new BigNumber(15),
|
||||||
|
head: "0x02",
|
||||||
|
version: 63
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -80,7 +80,7 @@ describe('api/rpc/parity', () => {
|
|||||||
|
|
||||||
describe('newPeers', () => {
|
describe('newPeers', () => {
|
||||||
it('returns the peer structure, formatted', () => {
|
it('returns the peer structure, formatted', () => {
|
||||||
mockHttp([{ method: 'parity_netPeers', reply: { result: { active: 123, connected: 456, max: 789 } } }]);
|
mockHttp([{ method: 'parity_netPeers', reply: { result: { active: 123, connected: 456, max: 789, peers: [] } } }]);
|
||||||
|
|
||||||
return instance.netPeers().then((peers) => {
|
return instance.netPeers().then((peers) => {
|
||||||
expect(peers.active.eq(123)).to.be.true;
|
expect(peers.active.eq(123)).to.be.true;
|
||||||
|
Loading…
Reference in New Issue
Block a user