UNPKG

524 BJavaScriptView Raw
1// Copyright 2017-2018 @polkadot/api-provider authors & contributors
2// This software may be modified and distributed under the terms
3// of the ISC license. See the LICENSE file for details.
4
5import createCoder from './index';
6
7describe('encodeJson', () => {
8 let coder;
9
10 beforeEach(() => {
11 coder = createCoder();
12 });
13
14 it('encodes a valid JsonRPC JSON string', () => {
15 expect(
16 coder.encodeJson('method', 'params')
17 ).toEqual('{"id":1,"jsonrpc":"2.0","method":"method","params":"params"}');
18 });
19});