From e54cee1fad4cde537f63c7c5708188e0ef63155b Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Thu, 10 Oct 2019 17:01:31 +0200 Subject: [PATCH] Cleanup codec .skip tests (#1467) --- packages/types/src/codec/Enum.spec.ts | 12 ------------ packages/types/src/codec/Tuple.spec.ts | 9 ++++----- packages/types/src/codec/Vec.spec.ts | 11 +++++------ 3 files changed, 9 insertions(+), 23 deletions(-) diff --git a/packages/types/src/codec/Enum.spec.ts b/packages/types/src/codec/Enum.spec.ts index 27780d7e03..20e3ba86f5 100644 --- a/packages/types/src/codec/Enum.spec.ts +++ b/packages/types/src/codec/Enum.spec.ts @@ -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( diff --git a/packages/types/src/codec/Tuple.spec.ts b/packages/types/src/codec/Tuple.spec.ts index c63e915887..5a9bc01019 100644 --- a/packages/types/src/codec/Tuple.spec.ts +++ b/packages/types/src/codec/Tuple.spec.ts @@ -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 => { diff --git a/packages/types/src/codec/Vec.spec.ts b/packages/types/src/codec/Vec.spec.ts index 72c362cc96..459f66e204 100644 --- a/packages/types/src/codec/Vec.spec.ts +++ b/packages/types/src/codec/Vec.spec.ts @@ -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)[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 => {