test(coverage): drive browser tests to 80% on all metrics (#496) #505
@@ -70,4 +70,30 @@ describe('CoCorrespondentsList', () => {
|
||||
|
||||
await expect.element(page.getByText('MM')).toBeVisible();
|
||||
});
|
||||
|
||||
it('handles a single-word name (initials use just one letter)', async () => {
|
||||
render(CoCorrespondentsList, {
|
||||
props: {
|
||||
coCorrespondents: [{ id: 'c-1', name: 'Cher', count: 2 }],
|
||||
personId: 'p-1'
|
||||
}
|
||||
});
|
||||
|
||||
// "Cher" → initials "C"
|
||||
const initialsBadge = document.querySelector('span.flex.h-4.w-4');
|
||||
expect(initialsBadge?.textContent?.trim()).toBe('C');
|
||||
});
|
||||
|
||||
it('handles a name part starting with empty string gracefully', async () => {
|
||||
render(CoCorrespondentsList, {
|
||||
props: {
|
||||
coCorrespondents: [{ id: 'c-1', name: ' Max', count: 1 }],
|
||||
personId: 'p-1'
|
||||
}
|
||||
});
|
||||
|
||||
// Leading space → name.split(' ') yields ['', '', 'Max']; first chars are '', '', 'M' → 'M'
|
||||
const initialsBadge = document.querySelector('span.flex.h-4.w-4');
|
||||
expect(initialsBadge?.textContent?.trim()).toContain('M');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user