UNPKG

@plugnet/rpc-rx

Version:
37 lines (29 loc) 974 B
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); var _util = require("@plugnet/util"); var _ = _interopRequireDefault(require(".")); // Copyright 2017-2019 @polkadot/rpc-rx authors & contributors // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. jest.mock('@plugnet/rpc-provider/ws', () => { var _temp; return _temp = class { constructor() { this.isConnected = () => true; this.on = () => true; this.send = () => true; } }, _temp; }); describe('RpcRx', () => { let api; beforeEach(() => { api = new _.default(); }); it('creates an instance with all sections', () => { expect(Object.keys(api).filter(key => !key.startsWith('_'))).toEqual(['author', 'chain', 'state', 'system']); }); it('has isConnected', () => { expect((0, _util.isFunction)(api.isConnected)).toBe(true); }); });