cmvr-wms/mobile-app/tests/blackbox-followup.test.mjs
lixiaolong cd86623061 feat(app): 添加服务器连接管理和到货操作功能
- 集成 ServerConnection 组件用于开发环境服务器切换
- 实现多服务器令牌隔离存储机制
- 添加 ArrivalOperation 屏幕处理到货和验收流程
- 支持待登记到货和待验收状态切换
- 优化库存操作界面的字段显示逻辑
- 增强 Excel 文件分片上传支持产品文件识别
- 添加 AI 助手会话滚动跟踪功能
- 实现开发服务器地址持久化存储
- 优化登录界面集成服务器连接组件
- 添加领用出库功能支持项目物资使用
- 改进盘点确认生效的操作流程
- 增强采购到货登记和验收的权限控制
- 优化移动端文件上传的断点续传机制
- 添加服务器切换时的数据清理保护机制
- 实现紧凑金额显示模式减少界面冗余
- 增强库存操作的数量验证和错误提示
- 优化 AI 助手的会话状态同步机制
2026-10-20 10:04:17 +08:00

38 lines
2.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import test from 'node:test';
import assert from 'node:assert/strict';
import {draftStatus,draftFieldText,referenceText,sheetSelectionError,draftOutcome,draftReviewCount} from '../src/core/assistant-display.ts';
test('nested internal price preview counts every business item for mobile confirmation limits',()=>{
assert.equal(draftReviewCount({rows:[{_referencePricePreview:Array.from({length:34},()=>({}))}]}),34);
assert.equal(draftReviewCount({rows:[{},{}]}),2);
const rows=Array.from({length:34},()=>({}));
assert.deepEqual(draftOutcome({action:'purchase.referencePrice',rows:[{_referencePricePreview:rows}],results:[{status:'SUCCEEDED',data:{changed:13,rows}}]}),{succeeded:13,skipped:21,failed:0,labels:[]});
});
test('skipped quote rows are identified without claiming a successful correction',()=>{
const draft={rows:[{_rowId:'a'},{_rowId:'b',_sourceText:'水冷一体管,4×29.2元'}],results:[{rowId:'a',status:'SUCCEEDED',data:{}},{rowId:'b',status:'SUCCEEDED',data:{skipped:true}}]};
assert.deepEqual(draftOutcome(draft),{succeeded:1,skipped:1,failed:0,labels:['水冷一体管,4×29.2元']});
});
import {modules,recordDisplay} from '../src/core/modules.ts';
test('draft statuses and field options use distinct business definitions',()=>{
assert.equal(draftStatus('CANCELLED'),'已取消');assert.equal(draftStatus('WAIT_CONFIRM'),'待确认');
assert.equal(draftFieldText({status:0},{key:'status',options:[{value:'0',label:'正常'}]}),'正常');
assert.equal(draftFieldText({status:0},{key:'status',options:[{value:'0',label:'待验收'}]}),'待验收');
assert.equal(draftFieldText({unit:'个',_labels:{unit:'个'}},{key:'unit'}),'个');
});
test('unmatched reference becomes readable identity, not raw JSON or an arbitrary ID',()=>{
assert.equal(referenceText({keyword:'螺丝',spec:'M6',brand:'测试牌'}),'螺丝 / M6 / 测试牌');
assert.match(referenceText({id:99}),/尚未匹配/);assert.equal(referenceText(null),'—');
});
test('Excel validity reflects current selection rather than the prior error',()=>{
const file={name:'分表.xlsx',type:'excel',selectedSheetIndexes:[1,2],sheets:[{index:0,rowCount:101},{index:1,rowCount:50},{index:2,rowCount:51}]};
assert.match(sheetSelectionError([file]),/101/);
assert.equal(sheetSelectionError([{...file,selectedSheetIndexes:[1]}]),'');
assert.match(sheetSelectionError([{...file,selectedSheetIndexes:[]}]),/请选择/);
});
test('purchase cards expose the same state enum as the real procurement page',()=>{
const purchase=modules.find(m=>m.key==='purchase');
assert.equal(purchase.fields[0][0],'purchaseStatus');
for(const [state,label] of Object.entries({0:'待采购',1:'已下单',2:'采购中',3:'部分到货',4:'已到齐',5:'已取消'}))assert.equal(recordDisplay(purchase,'purchaseStatus',state),label);
});