djust keys/entries retrieval batch sizes (#3638)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user