fix: improve maintenance and synchronize live conversations
This commit is contained in:
1 parent
bb541bd212
commit
ef86a5d3af
297 files changed
+2983
-1274
No files matched your search
@@ -84,12 +84,14 @@ vi.mock('@/services/api', () => ({
|
||||
// Mock agent service
|
||||
vi.mock('@/services/agent', () => ({
|
||||
agentService: {
|
||||
getAgentRoster: vi.fn().mockResolvedValue([]),
|
||||
getOrganizationAgents: vi.fn().mockResolvedValue([])
|
||||
}
|
||||
}))
|
||||
|
||||
// Import the mocked modules
|
||||
import { chatService } from '@/services/chat'
|
||||
import { agentService } from '@/services/agent'
|
||||
|
||||
describe('ConversationsView', () => {
|
||||
let wrapper: VueWrapper
|
||||
@@ -138,6 +140,20 @@ describe('ConversationsView', () => {
|
||||
expect(conversationsList.props('loading')).toBe(false)
|
||||
})
|
||||
|
||||
it('loads the lightweight agent roster used by the inbox filter', async () => {
|
||||
const roster = [{ id: 'agent-1', name: 'Ada', display_name: 'Ada Lovelace' }]
|
||||
vi.mocked(agentService.getAgentRoster).mockResolvedValue(roster)
|
||||
|
||||
wrapper = mount(ConversationsView)
|
||||
|
||||
await vi.waitFor(() => {
|
||||
const filters = wrapper.findComponent({ name: 'ConversationFilters' })
|
||||
expect(filters.props('agents')).toEqual(roster)
|
||||
})
|
||||
|
||||
expect(agentService.getAgentRoster).toHaveBeenCalledOnce()
|
||||
})
|
||||
|
||||
it('handles loading error', async () => {
|
||||
const errorMessage = '加载会话失败'
|
||||
;(chatService.getRecentChats as any).mockRejectedValue(new Error('API Error'))
|
||||
@@ -186,4 +202,4 @@ describe('ConversationsView', () => {
|
||||
|
||||
expect(chatService.getRecentChats).toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user