Files
common/packages/util/src/is/string.spec.ts
T
2023-03-06 14:17:56 +02:00

33 lines
687 B
TypeScript

// Copyright 2017-2023 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev/node/test/node" />
import { isString } from '.';
describe('isString', (): void => {
it('returns true on valid strings', (): void => {
expect(
isString('123')
).toEqual(true);
});
it('returns true on empty strings', (): void => {
expect(
isString('')
).toEqual(true);
});
it('returns true on String object', (): void => {
expect(
isString(String('foo'))
).toEqual(true);
});
it('returns false on invalid numbers', (): void => {
expect(
isString(2)
).toEqual(false);
});
});