Files
waggle-os/apps/web/src/lib/user-name.test.ts
shumeiko.it 659c84bee2 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.
2026-10-27 14:24:35 +01:00

19 lines
602 B
TypeScript

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();
});
});