Files
abaishu0730 94fc985553 feat: add guarded BPM category and template workflow
Implement server-owned read-only sample checks, category publication, explicit
order-version identity and durable PDF/archive/notification steps. Freeze
category-bound templates and recipients for isolated scheduled delivery, and
require human verification for unknown SMTP outcomes. Add order/batch views
and local HTTP/browser/PDF/archive regression coverage.

Fix Unicode Windows startup links found by full regression using IShellLinkW.
Automatic processing and sending stay disabled; no service deployment.

Validation: npm ci; npm test -- --test-concurrency=1 (242 pass, 1 optional
ZCode skip, 0 fail); 31 syntax checks; scoped independent code review.
Live BPM V13/SMB/163 acceptance remains pending.
2026-10-22 16:52:59 +08:00

22 lines
1.8 KiB
JavaScript

'use strict';
const test=require('node:test');const assert=require('node:assert/strict');
const {parseDetailUrl,extractFieldSnapshot}=require('../src/bpm-order-detail.cjs');
const url='https://bpm.skyworthdigital.com/YZSoft/Forms/XForm/海外运营订单评审V13.aspx?tid=100001&pid=900001';
test('detail URL keeps tid and pid and derives form version without allowing other origins',()=>{
assert.deepEqual(parseDetailUrl(url),{tid:'100001',pid:'900001',processVersion:'V13',processName:'海外运营订单评审'});
assert.throws(()=>parseDetailUrl('https://evil.example/form.aspx?tid=1&pid=2'),/不受支持/);
assert.throws(()=>parseDetailUrl(url.replace('tid=100001','tid=abc')),/tid\/pid/);
});
test('field snapshot reads explicit DOM binding names and preserves process steps read-only',()=>{
const result=extractFieldSnapshot({elements:[
{binding:'OFR_WY_Applicant.OrderNum',value:'000123',disabled:false},
{binding:'OFR_WY_BInfo.ProductModel',value:'MODEL-EXAMPLE-002',disabled:false},
{binding:'OFR_WY_BInfo.CustomerName',value:'CUSTOMER-EXAMPLE',disabled:true},
{binding:'OFR_WY_Applicant.OrderChangeContent',value:'摘要原文',disabled:false},
],processSteps:[{name:'订单专员(生效)',status:'处理中',at:null}],processName:'海外运营订单评审',nodeName:'订单专员(生效)',processVersion:'V13',processInstanceId:'900001'});
assert.equal(result.fields['OFR_WY_Applicant.OrderNum'],'000123');assert.equal(result.fields['OFR_WY_BInfo.CustomerName'],'CUSTOMER-EXAMPLE');assert.equal(result.processSteps[0].status,'处理中');assert.equal(result.readOnly,true);
});
test('missing process instance or bound fields is explicit',()=>{
assert.throws(()=>extractFieldSnapshot({elements:[],processSteps:[],processName:'海外运营订单评审',nodeName:'订单专员(生效)',processVersion:'V13'}),/流程实例|字段/);
});