Cleanup codec .skip tests (#1467)

This commit is contained in:
Jaco Greeff
2019-10-10 17:01:31 +02:00
committed by GitHub
parent 4e4108abfa
commit e54cee1fad
3 changed files with 9 additions and 23 deletions
-12
View File
@@ -111,18 +111,6 @@ describe('Enum', (): void => {
expect(new Test(1234, 1).toJSON()).toEqual({ B: 1234 });
});
// We are currently not using this approach, none of the types in Substrate currently
// have any overrides. Instead of trying to support it (just-in-case), rather have it
// removed to simplify the code - it can be pulled-back if needed
it.skip('allows checking against defined indexes', (): void => {
expect(
new Enum(
{ 1: Text, 5: U32 },
new Uint8Array([1, 2 << 2, 49, 50])
).toString()
).toEqual('Text');
});
it('allows accessing the type and value', (): void => {
const text = new Text('foo');
const enumType = new Enum(
+4 -5
View File
@@ -65,17 +65,16 @@ describe('Tuple', (): void => {
).toEqual('["foo",69,42]');
});
it.skip('creates properly via actual hex string', (): void => {
it('creates properly via actual hex string', (): void => {
Call.injectMetadata(new Metadata(metadataStatic));
const test = new (Tuple.with([
ClassOf('BlockNumber'), ClassOf('Proposal'), ClassOf('VoteThreshold')
ClassOf('BlockNumber'), ClassOf('VoteThreshold')
]
))('0x62190000000000000003507b0a092230783432223a202230783433220a7d0a01');
))('0x6219000001');
expect((test[0] as BlockNumber).toNumber()).toEqual(6498);
expect((test[1] as Call).callIndex).toEqual(new Uint8Array([0, 3]));
expect((test[2] as VoteThreshold).toNumber()).toEqual(1);
expect((test[1] as VoteThreshold).toNumber()).toEqual(1);
});
it('exposes the Types', (): void => {
+5 -6
View File
@@ -4,7 +4,7 @@
import '../injector';
import { Proposal, PropIndex } from '../interfaces/democracy';
import { PropIndex } from '../interfaces/democracy';
import { Codec, CodecTo } from '../types';
import Metadata from '../Metadata';
@@ -60,15 +60,14 @@ describe('Vec', (): void => {
expect(vector.Type).toEqual('Text');
});
it.skip('decodes a complex type via construction', (): void => {
const test = createTypeUnsafe('Vec<(PropIndex, Proposal, AccountId)>', [new Uint8Array([
4, 10, 0, 0, 0, 0, 3, 80, 123, 10, 9, 34, 48, 120, 52, 50, 34, 58, 32, 34, 48, 120, 52, 51, 34, 10, 125, 10, 209, 114, 167, 76, 218, 76, 134, 89, 18, 195, 43, 160, 168, 10, 87, 174, 105, 171, 174, 65, 14, 92, 203, 89, 222, 232, 78, 47, 68, 50, 219, 79
it('decodes a complex type via construction', (): void => {
const test = createTypeUnsafe('Vec<(PropIndex, AccountId)>', [new Uint8Array([
4, 10, 0, 0, 0, 209, 114, 167, 76, 218, 76, 134, 89, 18, 195, 43, 160, 168, 10, 87, 174, 105, 171, 174, 65, 14, 92, 203, 89, 222, 232, 78, 47, 68, 50, 219, 79
])]);
const first = (test as Vec<Codec>)[0] as Tuple;
expect((first[0] as PropIndex).toNumber()).toEqual(10);
expect((first[1] as Proposal).callIndex).toEqual(new Uint8Array([0, 3]));
expect((first[2] as AccountId).toString()).toEqual('5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ');
expect((first[1] as AccountId).toString()).toEqual('5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaQua');
});
describe('vector-like functions', (): void => {