Files
api/packages/api-provider/test/e2e.test.ts
T
Jaco Greeff 432f9a73a9 TypeScript conversion (#101)
* Auto-conversion

* ES6 import/export

* WIP...

* WIP...

* And... we are TS typed, some good, some bad, some better, some worse

* Tests passing
2018-06-23 13:39:31 +02:00

36 lines
913 B
TypeScript

// Copyright 2017-2018 @polkadot/api-provider authors & contributors
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
import { ApiInterface } from '../../api/src/types';
import createApi from '../../api/src';
import createProvider from '../src/ws';
describe.skip('e2e', () => {
let api: ApiInterface;
beforeEach(() => {
jest.setTimeout(30000);
api = createApi(createProvider('ws://127.0.0.1:9944'));
});
it('subscribes to client_newHead', (done) => {
let count = 0;
api.chain
.newHead((error: Error | null, data: any) => {
console.log('newHead: result =', [error, data]);
expect(data).toBeDefined();
if (++count === 3) {
done();
}
})
.then((subscriptionId) => {
console.log('newHead: subscriptionId =', subscriptionId);
});
});
});