Files
api/packages/rpc-rx/src/index.spec.js
T
Jaco Greeff 55ac4626d5 Cleanup imports from @polkadot/util (#315)
* Cleanup imports from @polkadot/util

* Example imports

* Alphabetic imports
2018-10-18 13:30:04 +02:00

40 lines
834 B
JavaScript

// Copyright 2017-2018 @polkadot/rpc-rx authors & contributors
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
import { isFunction } from '@polkadot/util';
jest.mock('@polkadot/rpc-provider/ws', () => class {
isConnected = () => true;
on = () => true;
send = () => true;
});
const RpcRx = require('./index').default;
describe('RpcRx', () => {
let api;
beforeEach(() => {
api = new RpcRx();
});
it('creates an instance with all sections', () => {
expect(
Object
.keys(api)
.filter((key) =>
!key.startsWith('_')
)
).toEqual([
'author', 'chain', 'state', 'system'
]);
});
it('has isConnected', () => {
expect(
isFunction(api.isConnected)
).toBe(true);
});
});