- 集成消息中心屏幕和未读消息徽章显示 - 实现消息中心后台轮询和应用状态监听 - 添加应用启动时的消息刷新逻辑 - 更新导航标题配置增加消息中心选项 - 在助手界面改进报价更正说明显示 - 增强AI助手报价单处理和文档识别功能 - 添加管理员消息发送权限控制和验证 - 优化采购参考价格操作的业务规则说明 - 修复AI助手权限验证中的通知操作检查
31 lines
2.1 KiB
JavaScript
31 lines
2.1 KiB
JavaScript
import { expect, it } from 'vitest'
|
|
import { mount, flushPromises } from '@vue/test-utils'
|
|
import ElementPlus from 'element-plus'
|
|
import Preview from '@/components/BusinessAssistant/AssistantReferencePricePreview.vue'
|
|
|
|
it('one combined preview renders actual amounts first, cleared quotes as empty rather than zero, and restrictions', async () => {
|
|
const wrapper = mount(Preview, { props: { rows: [
|
|
{ name: '模拟水泵', quantity: 2, quotePrice: 12.5, oldActualPrice: 1, newActualPrice: 12.5, oldActualAmount: 2, newActualAmount: 25, oldQuoteAmount: 25, newQuotePrice: null, newQuoteAmount: null, clearQuote: true, changed: true, blocked: false, notice: '先复制原报价,再清空报价' },
|
|
{ name: '模拟历史采购', quantity: 1, quotePrice: 0, newActualPrice: 0, newActualAmount: 0, newQuotePrice: null, newQuoteAmount: null, clearQuote: true, changed: true, blocked: true, notice: '已有到货或入库记录,整批不执行' }
|
|
] }, global: { plugins: [ElementPlus] } })
|
|
await flushPromises()
|
|
expect(wrapper.text()).toContain('实际金额与报价核对')
|
|
expect(wrapper.text()).toContain('清空(未报价)')
|
|
expect(wrapper.text()).toContain('不是 0 元')
|
|
expect(wrapper.find('.blocked').text()).toContain('整批不执行')
|
|
expect(wrapper.findAll('.removed').map(node => node.text())).toEqual(['12.5', '0'])
|
|
const headers = wrapper.findAll('thead th').map(node => node.text())
|
|
expect(headers.indexOf('新实际金额')).toBeLessThan(headers.indexOf('原报价单价'))
|
|
expect(headers).toContain('新报价金额')
|
|
wrapper.unmount()
|
|
})
|
|
|
|
it('reference-only mode still promises unchanged quotes and never shows clear-quote columns', async () => {
|
|
const wrapper = mount(Preview, { props: { rows: [{ name: '模拟物品', newActualPrice: 0, newActualAmount: 0, quotePrice: 0, changed: true }] }, global: { plugins: [ElementPlus] } })
|
|
await flushPromises()
|
|
expect(wrapper.text()).toContain('不修改报价及成本')
|
|
expect(wrapper.text()).not.toContain('清空(未报价)')
|
|
expect(wrapper.findAll('thead th').map(node => node.text())).not.toContain('新报价单价')
|
|
wrapper.unmount()
|
|
})
|