ant-design/components/_util/__tests__/capitalize.test.ts
vagusX 11ffb1ba6f
refactor: cssinjs for tag (#34422)
* feat: basic implements

* feat: add rtl

* feat: reorganize types

* test: add test cases for capitalize

* test: improve coverage

* chore: improve types

* chore: update

* chore: update
2022-03-15 15:33:50 +08:00

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);
});
});