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.
19 lines
602 B
TypeScript
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();
|
|
});
|
|
});
|