2026-10-05 18:10:18 -04:00
|
|
|
import { describe, expect, it } from 'vitest';
|
2022-06-26 14:34:09 -04:00
|
|
|
import { capitalize } from '@/lib/strings';
|
|
|
|
|
|
2026-10-08 16:53:20 -04:00
|
|
|
describe('@/lib/strings.ts', () => {
|
|
|
|
|
describe('capitalize()', () => {
|
|
|
|
|
it('should capitalize a string', () => {
|
2022-06-26 14:34:09 -04:00
|
|
|
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');
|
2022-06-26 14:34:09 -04:00
|
|
|
});
|
|
|
|
|
|
2026-10-08 16:53:20 -04:00
|
|
|
it('should handle empty strings', () => {
|
2022-06-26 14:34:09 -04:00
|
|
|
expect(capitalize('')).toBe('');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|