mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-04 14:39:34 +08:00
Ship folder-based workspaces and data migration, daily practice, redesigned provider and model settings, and streaming conversation improvements. Synchronize README translations and document the archive/permanent-delete upgrade behavior in assets/releases/ver1-6-9.md. Reduce initial JavaScript by deduplicating English resources and loading animation features after hydration. Keep the existing route size budgets. Update regression fixtures and browser audits for scoped URLs and the new settings and learning interfaces.
42 lines
1.8 KiB
TypeScript
42 lines
1.8 KiB
TypeScript
import { cleanup, render, screen } from '@testing-library/react'
|
|
import { afterEach, expect, it, vi } from 'vitest'
|
|
import { UserMessage } from '@/features/chat/messages/ChatMessageList'
|
|
import { initI18n } from '@/i18n/init'
|
|
|
|
initI18n('en')
|
|
vi.mock('@/lib/partners-api', () => ({ getPartner: async () => ({ name: 'Frank' }) }))
|
|
vi.mock('@/lib/partner-groups-api', () => ({ getPartnerGroup: async () => ({ name: 'Study group' }) }))
|
|
vi.mock('@/hooks/useConnectedAgentKinds', () => ({ useConnectedAgentKinds: () => ({ Codex: 'codex' }) }))
|
|
afterEach(cleanup)
|
|
|
|
it.each([
|
|
['consult_partner_id', 'partner-1', 'Ask partner', 'Frank'],
|
|
['partner_discussion_group_id', 'group-1', 'Organize partner discussion', 'Study group'],
|
|
])('renders the selected %s underneath a sent message', async (key, id, kind, name) => {
|
|
render(<UserMessage index={0} msg={{
|
|
id: 1, role: 'user', content: 'What is an agent?',
|
|
requestSnapshot: {
|
|
content: 'What is an agent?', enabledTools: [], knowledgeBases: [], language: 'en',
|
|
config: { [key]: id },
|
|
},
|
|
}} />)
|
|
expect(screen.getByText(kind)).toBeVisible()
|
|
expect(await screen.findByText(name)).toBeVisible()
|
|
})
|
|
|
|
it('keeps the subagent selection visible in the same reference tree', () => {
|
|
render(<UserMessage index={0} msg={{
|
|
role: 'user', content: 'Check this', requestSnapshot: {
|
|
content: 'Check this', enabledTools: [], knowledgeBases: ['Codex'], language: 'en',
|
|
},
|
|
}} />)
|
|
expect(screen.getByText('Ask subagent')).toBeVisible()
|
|
expect(screen.getByText('Codex')).toBeVisible()
|
|
})
|
|
|
|
it('does not add consultation references to an ordinary message', () => {
|
|
render(<UserMessage index={0} msg={{ role: 'user', content: 'Hello' }} />)
|
|
expect(screen.queryByText('Ask partner')).toBeNull()
|
|
expect(screen.queryByText('Organize partner discussion')).toBeNull()
|
|
})
|