mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-21 13:18:04 +08:00
18 lines
595 B
TypeScript
18 lines
595 B
TypeScript
|
import capitalize from '../capitalize';
|
||
|
|
||
|
describe('capitalize', () => {
|
||
|
it('should capitalize the first character of a string', () => {
|
||
|
expect(capitalize('antd')).toBe('Antd');
|
||
|
expect(capitalize('Antd')).toBe('Antd');
|
||
|
expect(capitalize(' antd')).toBe(' antd');
|
||
|
expect(capitalize('')).toBe('');
|
||
|
});
|
||
|
|
||
|
it('should return the original value when is not a string', () => {
|
||
|
expect(capitalize(1 as any)).toBe(1);
|
||
|
expect(capitalize(true as any)).toBe(true);
|
||
|
expect(capitalize(undefined as any)).toBe(undefined);
|
||
|
expect(capitalize(null as any)).toBe(null);
|
||
|
});
|
||
|
});
|