diff options
Diffstat (limited to 'jsonrpc.toBatchPayload.js')
-rw-r--r-- | jsonrpc.toBatchPayload.js | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/jsonrpc.toBatchPayload.js b/jsonrpc.toBatchPayload.js deleted file mode 100644 index b1b523f4..00000000 --- a/jsonrpc.toBatchPayload.js +++ /dev/null @@ -1,48 +0,0 @@ -var assert = require('assert'); -var jsonrpc = require('../lib/web3/jsonrpc'); -jsonrpc = new jsonrpc(); - -describe('jsonrpc', function () { - describe('toBatchPayload', function () { - it('should create basic batch payload', function () { - - // given - var messages = [{ - method: 'helloworld' - }, { - method: 'test2', - params: [1] - }]; - - // when - var payload = jsonrpc.toBatchPayload(messages); - - // then - assert.equal(payload instanceof Array, true); - assert.equal(payload.length, 2); - assert.equal(payload[0].jsonrpc, '2.0'); - assert.equal(payload[1].jsonrpc, '2.0'); - assert.equal(payload[0].method, 'helloworld'); - assert.equal(payload[1].method, 'test2'); - assert.equal(payload[0].params instanceof Array, true); - assert.equal(payload[1].params.length, 1); - assert.equal(payload[1].params[0], 1); - assert.equal(typeof payload[0].id, 'number'); - assert.equal(typeof payload[1].id, 'number'); - assert.equal(payload[0].id + 1, payload[1].id); - }); - - it('should create batch payload for empty input array', function () { - - // given - var messages = []; - - // when - var payload = jsonrpc.toBatchPayload(messages); - - // then - assert.equal(payload instanceof Array, true); - assert.equal(payload.length, 0); - }); - }); -}); |