Files
common/packages/util/src/hex/hasPrefix.spec.ts
T
Jaco e7771b02a4 Bump dev (#1132)
* Bump dev

* eslint 8 fixes

* Bump
2021-10-17 12:32:45 +03:00

32 lines
808 B
TypeScript

// Copyright 2017-2021 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { hexHasPrefix } from '.';
describe('hexHasPrefix', (): void => {
it('returns true when hex prefix is found', (): void => {
expect(
hexHasPrefix('0x123')
).toEqual(true);
});
it('returns false when no prefix attached', (): void => {
expect(
hexHasPrefix('123')
).toEqual(false);
});
it('returns false when null value supplied', (): void => {
expect(
hexHasPrefix(null)
).toEqual(false);
});
it('returns false when non-string value supplied', (): void => {
expect(
// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-argument
hexHasPrefix(false as any)
).toEqual(false);
});
});