diff --git a/src/rpc/index.js b/src/rpc/index.js index b9667bc..34fe499 100644 --- a/src/rpc/index.js +++ b/src/rpc/index.js @@ -21,7 +21,7 @@ class JSONRPC { console.log('router str: ', str) const parsedData = _this.jsonrpc.parse(str) - // console.log('parsedData: ', parsedData) + console.log('parsedData: ', parsedData) // console.log('parsedData.type: ', parsedData.type) // Exit quietly if the incoming string is invalid diff --git a/test/unit/biz-logic/a10-rpc.unit.js b/test/unit/biz-logic/a10-rpc.unit.js new file mode 100644 index 0000000..84f36dc --- /dev/null +++ b/test/unit/biz-logic/a10-rpc.unit.js @@ -0,0 +1,31 @@ +/* + Unit tests for the rpc/index.js library. +*/ + +// Public npm libraries +const jsonrpc = require('jsonrpc-lite') + +const JSONRPC = require('../../../src/rpc') + +describe('#JSON RPC', () => { + let uut + + beforeEach(() => { + uut = new JSONRPC() + }) + + describe('#router', () => { + it('should do something', async () => { + // const request = { + // 'users', // id + // 'getAll', // method + // {} + // } + const json = jsonrpc.request('users', 'getAll', {}) + + const str = JSON.stringify(json) + + await uut.router(str) + }) + }) +}) diff --git a/test/unit/json-rpc/a10-rpc.unit.js b/test/unit/json-rpc/a10-rpc.unit.js new file mode 100644 index 0000000..84f36dc --- /dev/null +++ b/test/unit/json-rpc/a10-rpc.unit.js @@ -0,0 +1,31 @@ +/* + Unit tests for the rpc/index.js library. +*/ + +// Public npm libraries +const jsonrpc = require('jsonrpc-lite') + +const JSONRPC = require('../../../src/rpc') + +describe('#JSON RPC', () => { + let uut + + beforeEach(() => { + uut = new JSONRPC() + }) + + describe('#router', () => { + it('should do something', async () => { + // const request = { + // 'users', // id + // 'getAll', // method + // {} + // } + const json = jsonrpc.request('users', 'getAll', {}) + + const str = JSON.stringify(json) + + await uut.router(str) + }) + }) +})