1 import capitalize from './capitalize';
3 describe('capitalize()', () => {
4 it('returns undefined when called with undefined', () => {
5 expect(capitalize(undefined)).toBe(undefined);
8 it('returns an empty string when an empty string is provided', () => {
9 expect(capitalize('')).toBe('');
12 it('capitalizes a single letter', () => {
13 expect(capitalize('a')).toBe('A');
16 it('capitalizes only the first letter', () => {
17 expect(capitalize('abc')).toBe('Abc');
20 it('capitalizes the first letter even if it is already a capital', () => {
21 expect(capitalize('Abc')).toBe('Abc');
24 it(`doesn't affect other capital letters`, () => {
25 expect(capitalize('ABc')).toBe('ABc');