Skip to content
This repository has been archived by the owner on Dec 10, 2020. It is now read-only.

Commit

Permalink
test(rpc): add test of call JSON RPC with non-exist method
Browse files Browse the repository at this point in the history
  • Loading branch information
tomonari-t committed Jun 6, 2020
1 parent 33d5833 commit 1348503
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/rpc/rpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,26 @@ test('call JSON RPC with non-exist method', t => {
t.end(err)
})
})

test('call JSON RPC with non-params method', t => {
const server = startRPC({})
const req = {
jsonrpc: '2.0',
method: 'web3_clientVersion',
id: 1
}

request(server)
.post('/')
.set('Content-Type', 'application/json')
.send(req)
.expect(res => {
if (!res.body.error) {
throw new Error('should return an error object')
}
})
.end(err => {
closeRPC(server)
t.end(err)
})
})

0 comments on commit 1348503

Please sign in to comment.