Files
api/packages/rpc-core/test/e2e/chain.test.js
T
Jaco Greeff 4805f9cb36 Update LICENSE and README (#408)
* Update LICENSE and README

* Bump
2018-11-21 13:37:27 +01:00

47 lines
1.0 KiB
JavaScript

// Copyright 2017-2018 @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 Ws from '@polkadot/rpc-provider/ws';
import Rpc from '../../src';
describe.skip('e2e chain', () => {
let api;
beforeEach(() => {
jest.setTimeout(30000);
api = new Rpc(new Ws('ws://127.0.0.1:9944'));
});
it('subscribes via subscribeNewHead', (done) => {
let count = 0;
// tslint:disable-next-line
api.chain
.subscribeNewHead((header) => {
expect(header).toBeDefined();
if (++count === 3) {
done();
}
})
.then((subscriptionId) => {
console.log('newHead: subscriptionId =', subscriptionId);
});
});
it('retrieves the runtime version', () => {
return api.chain
.getRuntimeVersion()
.then((version) => {
console.error('version', version);
})
.catch((error) => {
console.error(error);
throw error;
});
});
});