fix: never greet the user by the assistant's default name (UF-055)

Home and the sidebar read the user's name from the identity row, which the
sidecar fills with the assistant's identity named Waggle. Both now use the
profile name, with the identity name as a fallback that skips the default.
This commit is contained in:
shumeiko.it
2026-10-27 14:24:35 +01:00
parent c2998f1a6b
commit 659c84bee2
8 changed files with 111 additions and 13 deletions

View File

@@ -0,0 +1,18 @@
import { describe, it, expect } from 'vitest';
import { pickUserName } from './user-name';
describe('pickUserName (UF-055)', () => {
it('prefers the name in the profile', () => {
expect(pickUserName('Ana', 'Waggle')).toBe('Ana');
expect(pickUserName(' Ana ', 'Marko')).toBe('Ana');
});
it('falls back to a real identity name', () => {
expect(pickUserName('', 'Marko')).toBe('Marko');
});
it('never returns the assistant default name as the user', () => {
expect(pickUserName(null, 'Waggle')).toBeNull();
expect(pickUserName(undefined, undefined)).toBeNull();
});
});