Files
api/packages/api-provider/test/e2e.krummelanke.test.js
T
Jaco Greeff d9b05cf9f2 Decode runtime metadata (#162)
* WIP

* Some output, still borken...

* Events decoded correctly

* WIP, metadata decoded

* String cleanups

* Expand with generics

* Add getters

* Start docs...

* Additional docs

* Extra whitespace on Compact

* CodecLength FIXME

* Remove FIXME (impl. takes care)

* Swap in LengthCompact encoding

* Extend docs, play with auto-type for struct

* Trim strings, add Type for type-specific String

* More string-type hackery

* Don't allow Type re-encoding

* Remove struct experiment

* Cleanup Option

* Remove extra type defs from CodecStruct usage

* Expand Storage function with map (and type returns)

* Description around BaseCodec

* Cleanup linting, add Metadata test

* Move to api-codec

* Extract uniq types

* Uniq updates

* Unwrap, ungeneric
2018-09-24 13:51:20 +02:00

68 lines
1.8 KiB
JavaScript

// 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 storage from '@polkadot/storage';
import Api from '../../api/src';
import Ws from '../src/ws';
describe.skip('e2e krumme lanke', () => {
let api;
beforeEach(() => {
jest.setTimeout(30000);
api = new Api(new Ws('ws://127.0.0.1:9944'));
});
it('subscribes to storage', (done) => {
api.state
.subscribeStorage(
[
[storage.system.public.accountIndexOf, '5Ejbye9R8ygByQPrDSasaUid1munedPZUmg4f118HGmtodGp'],
[storage.staking.public.freeBalanceOf, '5DTestUPts3kjeXSTMyerHihn1uwMfLj8vU8sqF7qYrFacT7']
],
(error, data) => {
if (error) {
return done(error);
}
expect(data).toHaveLength(2);
expect(data[0].toNumber()).toEqual(0);
expect(data[1].toNumber()).not.toEqual(0);
done();
}
)
.then((subscriptionId) => {
console.log('newHead: subscriptionId =', subscriptionId);
});
});
it('retrieves a block by hash (krumme lanke #1)', () => {
return api.chain
.getBlock('0x627847bffdf5f3e01ac440d057dec6a37a12a6f329db7ef8367665574b76b5df')
.then((block) => {
expect(block).toBeDefined();
})
.catch((error) => {
console.error(error);
throw error;
});
});
it('retrieves a block by hash (krumme lanke #2)', () => {
return api.chain
.getBlock('0x53416d53a4b1dfcae9165a89d193608e4aa770414f02267f5b2c4015a2e66091')
.then((block) => {
expect(block).toBeDefined();
})
.catch((error) => {
console.error(error);
throw error;
});
});
});