Skip to content

The agent that grows with you

test(desktop): cover Unicode profile initials and default glyph behavior

brooklyn!bb4130f6f590
diff --git a/apps/desktop/src/components/ui/profile-glyph.test.tsx b/apps/desktop/src/components/ui/profile-glyph.test.tsx
new file mode 100644
index 00000000000..27d069c21ad
--- /dev/null
+++ b/apps/desktop/src/components/ui/profile-glyph.test.tsx
@@ -0,0 +1,23 @@
+import { cleanup, render } from '@testing-library/react'
+import { afterEach, describe, expect, it } from 'vitest'
+
+import { ProfileGlyph } from './profile-glyph'
+
+afterEach(cleanup)
+
+describe('ProfileGlyph', () => {
+ it('preserves the first readable grapheme across scripts and emoji', () => {
+ const names = ['研究助手', 'Работа', 'Ελληνικά', 'Álvaro', 'A\u0301lvaro', '👨‍💻', '🇨🇳', '1️⃣ helper', '𠮷野', '--dev', '']
+ const expected = ['研', 'Р', 'Ε', 'Á', 'A\u0301', '👨‍💻', '🇨🇳', '1️⃣', '𠮷', 'd', '?']
+ const { container } = render(<>{names.map(name => <ProfileGlyph color={null} isDefault={false} key={name} name={name} />)}</>)
+
+ expect(Array.from(container.children, child => child.textContent)).toEqual(expected)
+ })
+
+ it('keeps the default profile home mark instead of using an initial', () => {
+ const { container } = render(<ProfileGlyph color={null} isDefault name="研究助手" />)
+
+ expect(container.textContent).toBe('')
+ expect(container.querySelector('.codicon-home')).not.toBeNull()
+ })
+})