djust keys/entries retrieval batch sizes (#3638)

This commit is contained in:
Jaco
2021-06-11 18:09:47 +02:00
committed by GitHub
parent 94aa79d1e5
commit f46916b215
3 changed files with 20 additions and 3 deletions
+16 -1
View File
@@ -1,7 +1,9 @@
// Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { BN } from '@polkadot/util';
import BNOrig from 'bn.js';
import { BN, BN_TWO } from '@polkadot/util';
import { TypeRegistry } from '../create';
import { UInt } from '.';
@@ -9,6 +11,19 @@ import { UInt } from '.';
describe('UInt', (): void => {
const registry = new TypeRegistry();
it('still has the BN interfaces', (): void => {
expect([
new UInt(registry, 32).mul(BN_TWO).toNumber(),
new UInt(registry, 64).divn(2).toNumber()
]).toEqual([64, 32]);
});
it('is a BN instance', (): void => {
expect(
BNOrig.isBN(new UInt(registry, 16))
).toBe(true);
});
it('fails on a number that is too large for the bits specified', (): void => {
expect(
(): UInt => new UInt(registry, '12345678901234567890123456789012345678901234567890', 32)