- 新增 user.check 功能用于核对人员是否已有系统账号 - 在 assistant-table-layout.js 中为用户表格添加 checkedIdentity 和 matchResult 字段 - 优化 AssistantConversationService 中的任务记忆和澄清流程 - 支持对草稿特定行进行修改,无需重新填写整张表 - 限制 user.check 操作最大查询数量为 100 条记录 - 实现中断任务恢复机制,保持原始请求上下文 - 添加针对多行数据选择性修改的目标行标识支持
25 lines
1.7 KiB
JavaScript
25 lines
1.7 KiB
JavaScript
import { beforeEach, expect, it, vi } from 'vitest'
|
|
const state=vi.hoisted(()=>({store:{delCachedView:vi.fn(),addCachedView:vi.fn()},router:{currentRoute:{value:{path:'/warehouse/stock',query:{projectId:'1'},hash:'#row-3',meta:{},matched:[]}},replace:vi.fn()}}))
|
|
vi.mock('@/store/modules/tagsView',()=>({default:()=>state.store}))
|
|
vi.mock('@/store/modules/permission',()=>({default:()=>({landingPath:'/index'})}))
|
|
vi.mock('@/router',()=>({default:state.router}))
|
|
import tab from '../../src/plugins/tab.js'
|
|
import { registerPageGuard } from '../../src/utils/page-guards.js'
|
|
beforeEach(()=>{vi.clearAllMocks();state.router.currentRoute.value={path:'/warehouse/stock',query:{projectId:'1'},hash:'#row-3',meta:{},matched:[]}})
|
|
it('refresh preserves query and hash instead of losing the current anchor',async()=>{
|
|
expect(await tab.refreshPage()).toBe(true)
|
|
expect(state.router.replace).toHaveBeenCalledExactlyOnceWith({path:'/redirect/warehouse/stock',query:{projectId:'1'},hash:'#row-3'})
|
|
})
|
|
it('repeated clicks while a guard is pending cause one navigation, and cancellation evicts no cache',async()=>{
|
|
let resolve;const stop=registerPageGuard('/warehouse/stock',()=>new Promise(done=>{resolve=done}))
|
|
try{
|
|
const pending=tab.refreshPage();expect(await tab.refreshPage()).toBe(false)
|
|
resolve(false);expect(await pending).toBe(false)
|
|
expect(state.store.delCachedView).not.toHaveBeenCalled();expect(state.router.replace).not.toHaveBeenCalled()
|
|
}finally{stop()}
|
|
})
|
|
it('intermediate redirect route never refreshes itself recursively',async()=>{
|
|
state.router.currentRoute.value.path='/redirect/warehouse/stock'
|
|
expect(await tab.refreshPage()).toBe(false);expect(state.router.replace).not.toHaveBeenCalled()
|
|
})
|