Files
api/packages/api-derive/test/e2e/derive.spec.ts
T
Amaury Martiny d07ed8ac38 Refactor api-promise/rx (#566)
* Use a generic abstract OnCall

* Add OnCall for Promise

* First run at fixing extrinsics

* Fix types

* Make submittable extrinsic work

* Move file

* Make derive work

* Fix types

* Only call metadata once

* Make tests pass

* Put event emitter in apirx

* Fix small bugs

* Fix tests

* Fix bug decorateStorage

* Make tests pass for tx

* Move rpc base to apirx

* Fix lint

* Fix small bugs

* Fix bug with isSubscription

* Fix codeclimate

* Revert

* Add tslint disable line

* Fix lint

* Skip e2e

* Typo

* Lint

* Re-add combinator back

* Add ._rx in Base

* Make extrinsics work

* Update derivex

* Fix bug lint

* Fix circular dep

* Fix bug e2e

* Remove useless check

* Add description comment

* Clean stuff

* Move assert to Base

* Bump version, update CHANGELOG

* Make _rx private

* Private emit
2019-01-16 15:42:59 +01:00

41 lines
1.1 KiB
TypeScript

// Copyright 2017-2018 @polkadot/api-derive 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 BN from 'bn.js';
import ApiRx from '@polkadot/api/rx';
import { ApiInterface$Rx } from '@polkadot/api/types';
import { BlockNumber } from '@polkadot/types/index';
describe.skip('derive e2e', () => {
let api: ApiInterface$Rx;
beforeAll(() => {
jest.setTimeout(30000);
});
beforeEach(async (done) => {
api = await ApiRx.create().toPromise();
done();
});
it('derive.chain.bestNumber', async (done) => {
api.derive.chain.bestNumber().subscribe((blockNumber) => {
expect(blockNumber instanceof BlockNumber).toBe(true);
expect((blockNumber as BlockNumber).gten(0)).toBe(true);
done();
});
});
it('derive.session.sessionProgress', async (done) => {
api.derive.session.sessionProgress().subscribe((progress) => {
expect(progress instanceof BN).toBe(true);
done();
});
});
afterAll(() => {
jest.setTimeout(5000);
});
});