Files
api/packages/metadata/src/MagicNumber.spec.ts
T
Jaco 3de06c1d4c Support for metadata v13 (#3465)
* Support for metadata v13

* Lint fixes

* Lastest tag as string

* Documentation

* MagicNumber opt

* NMap enum entry

* NMapTypeLatest

* Adjust for NMap type overrides

* Static from v13

* Basic NMap support

* lint

* Test expectations
2021-05-05 08:55:49 +02:00

29 lines
764 B
TypeScript

// Copyright 2017-2021 @polkadot/metadata authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { TypeRegistry } from '@polkadot/types/create';
import { MAGIC_NUMBER, MagicNumber } from './MagicNumber';
describe('MagicNumber', (): void => {
const registry = new TypeRegistry();
it('succeeds when the magic number matches', (): void => {
expect(
() => new MagicNumber(registry, MAGIC_NUMBER)
).not.toThrow();
});
it('succeeds when the magic number is empty', (): void => {
expect(
() => new MagicNumber(registry)
).not.toThrow();
});
it('fails when the magic number mismatches', (): void => {
expect(
() => new MagicNumber(registry, 0x12345678)
).toThrow(/MagicNumber mismatch/);
});
});