33 lines
687 B
TypeScript
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);
|
|
});
|
|
});
|