Bump dev & adjust duplicated exports (#5651)
This commit is contained in:
@@ -16,7 +16,7 @@ describe('Compact', (): void => {
|
||||
|
||||
describe('constructor', (): void => {
|
||||
it('fails on > MAX_SAFE_INTEGER', (): void => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision
|
||||
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision, no-loss-of-precision
|
||||
expect(() => new Compact(registry, 'u128', 9007199254740999)).toThrow(/integer <= Number.MAX_SAFE_INTEGER/);
|
||||
});
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ describe('Result', (): void => {
|
||||
it('decodes from a u8a (success)', (): void => {
|
||||
const result = new Type(registry, new Uint8Array([0, 1, 2, 3, 4]));
|
||||
|
||||
expect(result.isOk);
|
||||
expect(result.isOk).toBe(true);
|
||||
expect(result.asOk.toU8a()).toEqual(new Uint8Array([1, 2, 3, 4]));
|
||||
expect(result.toHex()).toEqual('0x0001020304');
|
||||
expect(result.toJSON()).toEqual({
|
||||
@@ -29,7 +29,7 @@ describe('Result', (): void => {
|
||||
it('decodes from a u8a (error)', (): void => {
|
||||
const result = new Type(registry, new Uint8Array([1, 4 << 2, 100, 101, 102, 103]));
|
||||
|
||||
expect(result.isErr);
|
||||
expect(result.isErr).toBe(true);
|
||||
expect(result.asErr.toU8a()).toEqual(new Uint8Array([4 << 2, 100, 101, 102, 103]));
|
||||
expect(result.toHex()).toEqual('0x011064656667');
|
||||
expect(result.toJSON()).toEqual({
|
||||
|
||||
@@ -13,9 +13,9 @@ describe('UInt', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
it('fails on > MAX_SAFE_INTEGER and float', (): void => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision
|
||||
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision, no-loss-of-precision
|
||||
expect(() => new UInt(registry, 9007199254740999)).toThrow(/integer <= Number.MAX_SAFE_INTEGER/);
|
||||
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision
|
||||
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision, no-loss-of-precision
|
||||
expect(() => new UInt(registry, -9007199254740999)).toThrow(/integer <= Number.MAX_SAFE_INTEGER/);
|
||||
expect(() => new UInt(registry, 9.123)).toThrow(/integer <= Number.MAX_SAFE_INTEGER/);
|
||||
});
|
||||
|
||||
@@ -39,7 +39,7 @@ describe('Vec', (): void => {
|
||||
expect(new Vec(registry, Text, null)).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('decodes a complex type via construction', (): void => {
|
||||
it('decodes a complex type via construction (1)', (): void => {
|
||||
const test = createTypeUnsafe<Vec<ITuple<[PropIndex, AccountId]>>>(registry, '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
|
||||
])]);
|
||||
@@ -48,7 +48,7 @@ describe('Vec', (): void => {
|
||||
expect(test[0][1].toString()).toEqual('5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaQua');
|
||||
});
|
||||
|
||||
it('decodes a complex type via construction', (): void => {
|
||||
it('decodes a complex type via construction (2)', (): void => {
|
||||
const INPUT = '0x08cc0200000000ce0200000001';
|
||||
const test = createTypeUnsafe<Vec<Codec>>(registry, 'Vec<(u32, [u32; 0], u16)>', [INPUT]);
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ export class BTreeSet<V extends Codec = Codec> extends Set<V> implements ISet<V>
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
public inspect (): Inspect {
|
||||
const inner = new Array<Inspect>();
|
||||
const inner: Inspect[] = [];
|
||||
|
||||
for (const v of this.values()) {
|
||||
inner.push(v.inspect());
|
||||
@@ -218,7 +218,7 @@ export class BTreeSet<V extends Codec = Codec> extends Set<V> implements ISet<V>
|
||||
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
||||
*/
|
||||
public toU8a (isBare?: boolean): Uint8Array {
|
||||
const encoded = new Array<Uint8Array>();
|
||||
const encoded: Uint8Array[] = [];
|
||||
|
||||
if (!isBare) {
|
||||
encoded.push(compactToU8a(this.size));
|
||||
|
||||
@@ -15,7 +15,7 @@ const registry = new TypeRegistry();
|
||||
describe('BitVec', (): void => {
|
||||
describe('decoding known', (): void => {
|
||||
TESTS.forEach((test): void => {
|
||||
describe(test, (): void => {
|
||||
describe(`${test}`, (): void => {
|
||||
const input = hexToU8a(test);
|
||||
const bitvec = new BitVec(registry, input);
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ export class CodecMap<K extends Codec = Codec, V extends Codec = Codec> extends
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
public inspect (): Inspect {
|
||||
const inner = new Array<Inspect>();
|
||||
const inner: Inspect[] = [];
|
||||
|
||||
for (const [k, v] of this.entries()) {
|
||||
inner.push(k.inspect());
|
||||
@@ -240,7 +240,7 @@ export class CodecMap<K extends Codec = Codec, V extends Codec = Codec> extends
|
||||
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
||||
*/
|
||||
public toU8a (isBare?: boolean): Uint8Array {
|
||||
const encoded = new Array<Uint8Array>();
|
||||
const encoded: Uint8Array[] = [];
|
||||
|
||||
if (!isBare) {
|
||||
encoded.push(compactToU8a(this.size));
|
||||
|
||||
@@ -233,7 +233,7 @@ export class Struct<
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
public inspect (isBare?: BareOpts): Inspect {
|
||||
const inner = new Array<Inspect>();
|
||||
const inner: Inspect[] = [];
|
||||
|
||||
for (const [k, v] of this.entries()) {
|
||||
inner.push({
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* global it */
|
||||
|
||||
// Shamelessly copied from @polkadot/util/test
|
||||
|
||||
import { formatDecimal, formatNumber } from '@polkadot/util';
|
||||
|
||||
Reference in New Issue
Block a user