Files
common/packages/util/src/is/codec.spec.ts
T
2021-11-18 09:57:26 +02:00

23 lines
508 B
TypeScript

// Copyright 2017-2021 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { isCodec } from '.';
describe('isCodec', (): void => {
it('is false on no value', (): void => {
expect(isCodec()).toEqual(false);
});
it('is true when codec-like signature is found', (): void => {
expect(
isCodec({
registry: {
get: () => null
},
toHex: () => '0x',
toU8a: () => new Uint8Array()
})
).toEqual(true);
});
});