feat: revue de code, doc CODE_REVIEW, forfaits 2026, traduction LLM, providers avec modèle
Made-with: Cursor
This commit is contained in:
28
frontend/src/test/utils.test.ts
Normal file
28
frontend/src/test/utils.test.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { getInitials } from '../app/dashboard/utils';
|
||||
|
||||
describe('getInitials', () => {
|
||||
it('should return first two initials for full name', () => {
|
||||
expect(getInitials('John Doe')).toBe('JD');
|
||||
});
|
||||
|
||||
it('should return single initial for single name', () => {
|
||||
expect(getInitials('Jane')).toBe('J');
|
||||
});
|
||||
|
||||
it('should handle names with multiple spaces', () => {
|
||||
expect(getInitials('John Jacob Jingleheimer Schmidt')).toBe('JJ');
|
||||
});
|
||||
|
||||
it('should return ? for empty string', () => {
|
||||
expect(getInitials('')).toBe('?');
|
||||
});
|
||||
|
||||
it('should return ? for undefined', () => {
|
||||
expect(getInitials(undefined as unknown as string)).toBe('?');
|
||||
});
|
||||
|
||||
it('should handle lowercase names', () => {
|
||||
expect(getInitials('john doe')).toBe('JD');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user