fix: stabilize the live recommendation path
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
bfea9efb5e
commit
dbc5c2d93f
12 changed files with 113 additions and 31 deletions
|
|
@ -85,6 +85,48 @@ describe('result presentation', () => {
|
|||
expect(onReset).toHaveBeenCalledOnce()
|
||||
})
|
||||
|
||||
it('renders demo as a header button and hides logout for a seeded user', () => {
|
||||
const demoUrl = 'https://demo.example.com'
|
||||
const root = mountComponent(AppHeader, {
|
||||
auth: {
|
||||
status: 'authenticated',
|
||||
user: { display_name: 'Seed Listener', can_logout: false },
|
||||
message: null,
|
||||
},
|
||||
mode: 'live',
|
||||
healthFailed: false,
|
||||
demoUrl,
|
||||
})
|
||||
const demoLink = root.querySelector<HTMLAnchorElement>('a.demo-link')
|
||||
|
||||
expect(demoLink?.classList.contains('button')).toBe(true)
|
||||
expect(demoLink?.href).toBe(`${demoUrl}/`)
|
||||
expect(demoLink?.textContent).toContain('demo')
|
||||
expect(root.textContent).toContain('Seed Listener')
|
||||
expect(root.textContent).not.toContain('Log out')
|
||||
})
|
||||
|
||||
it('keeps logout available for an interactive local user', () => {
|
||||
const onLogout = vi.fn()
|
||||
const root = mountComponent(AppHeader, {
|
||||
auth: {
|
||||
status: 'authenticated',
|
||||
user: { display_name: 'Local Listener', can_logout: true },
|
||||
message: null,
|
||||
},
|
||||
mode: 'live',
|
||||
healthFailed: false,
|
||||
demoUrl: null,
|
||||
onLogout,
|
||||
})
|
||||
const logout = [...root.querySelectorAll<HTMLButtonElement>('button')].find((button) =>
|
||||
button.textContent?.includes('Log out'),
|
||||
)
|
||||
|
||||
logout?.click()
|
||||
expect(onLogout).toHaveBeenCalledOnce()
|
||||
})
|
||||
|
||||
it('keeps completion context outside the focusable track region', () => {
|
||||
const root = mountComponent(AssistantMessage, { turn: doneTurn(), canSave: true })
|
||||
const region = root.querySelector<HTMLElement>(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue