Files
api/packages/api/test/e2e/rpc-core/chain.spec.ts
T
Jaco Greeff 478f54c703 Convert RPC classes to primitive classes or /srml types (#1192)
* Convert RPC classes to primitive classes or /srml types

* Lint passes... lokking at tests next.

* Tests pass.

* Types with basic docs (lots of work here)

* Update StorageKey.spec.ts

* Add injector to metadata doc generation

* Fix import
2019-07-26 10:23:37 +02:00

43 lines
1.1 KiB
TypeScript

// Copyright 2017-2019 @polkadot/rpc-core authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { RuntimeVersion } from '@polkadot/types/srml/types';
import { ClassOf, Header } from '@polkadot/types';
import WsProvider from '@polkadot/rpc-provider/ws';
import Rpc from '@polkadot/rpc-core';
describe.skip('e2e chain', (): void => {
let rpc: Rpc;
beforeEach((): void => {
jest.setTimeout(30000);
rpc = new Rpc(new WsProvider('ws://127.0.0.1:9944'));
});
it('subscribes via subscribeNewHead', (done): void => {
let count = 0;
rpc.chain
.subscribeNewHead()
.subscribe((header: Header): void => {
expect(header).toBeInstanceOf(Header);
if (++count === 3) {
done();
}
});
});
it('retrieves the runtime version', (done): void => {
rpc.chain
.getRuntimeVersion()
.subscribe((version: RuntimeVersion): void => {
expect(version).toBeInstanceOf(ClassOf('RuntimeVersion'));
done();
});
});
});