-
Notifications
You must be signed in to change notification settings - Fork 169
/
Copy pathcapitalize.spec.ts
39 lines (30 loc) · 1.02 KB
/
capitalize.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { capitalize } from './capitalize';
describe('capitalize', () => {
it('should convert "xyz" to "Xyz"', () => {
expect(capitalize('xyz')).toBe('Xyz');
});
it('should convert "xyz xyz" to "Xyz xyz"', () => {
expect(capitalize('xyz xyz')).toBe('Xyz xyz');
});
it('should convert " xyz" to " xyz"', () => {
expect(capitalize(' xyz')).toBe(' xyz');
});
it('should convert undefined to ""', () => {
expect(capitalize(undefined as unknown as string)).toBe('');
});
it('should convert null to ""', () => {
expect(capitalize(null as unknown as string)).toBe('');
});
it('should convert false to ""', () => {
expect(capitalize(false as unknown as string)).toBe('');
});
it('should convert true to ""', () => {
expect(capitalize(true as unknown as string)).toBe('');
});
it('should convert 0 to ""', () => {
expect(capitalize(0 as unknown as string)).toBe('');
});
it('should convert 1 to ""', () => {
expect(capitalize(1 as unknown as string)).toBe('');
});
});