Files

21 lines
733 B
TypeScript
Raw Permalink Normal View History

2026-10-05 18:10:18 -04:00
import { describe, expect, it } from 'vitest';
import { capitalize } from '@/lib/strings';
2026-10-08 16:53:20 -04:00
describe('@/lib/strings.ts', () => {
describe('capitalize()', () => {
it('should capitalize a string', () => {
expect(capitalize('foo bar')).toBe('Foo bar');
2026-10-05 18:10:18 -04:00
expect(capitalize('FOOBAR')).toBe('FOOBAR');
});
2026-10-08 16:53:20 -04:00
it('should preserve the casing of the remaining characters', () => {
2026-10-05 18:10:18 -04:00
expect(capitalize('invalid CPU limit.')).toBe('Invalid CPU limit.');
expect(capitalize('the IPv4 address is invalid')).toBe('The IPv4 address is invalid');
});
2026-10-08 16:53:20 -04:00
it('should handle empty strings', () => {
expect(capitalize('')).toBe('');
});
});
});