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.
11 lines
1.4 KiB
JavaScript
11 lines
1.4 KiB
JavaScript
'use strict';
|
|
const test=require('node:test');const assert=require('node:assert/strict');const fs=require('node:fs');const os=require('node:os');const path=require('node:path');
|
|
const {NotificationStore,NotificationService}=require('../src/notifications.cjs');
|
|
test('order bridge rejects unarchived evidence and generic dispatcher cannot pick up order managed events',t=>{
|
|
const dir=fs.mkdtempSync(path.join(os.tmpdir(),'order-bridge-')),store=new NotificationStore(dir);t.after(()=>{store.close();fs.rmSync(dir,{recursive:true,force:true});});const service=new NotificationService({store,mail:{},settings:()=>({groups:[]})});
|
|
const order={versionKey:'order-v1',businessVersion:'v1',orderNo:'000123',source:'portal-v4',taskId:'t',productLine:'L',brief:'原文\n第二行',subject:'原文\n第二行',businessTime:'2026-10-22T01:00:00Z',ruleId:'r',templateId:'tpl',steps:{archive:{status:'error'}}};
|
|
assert.throws(()=>service.ingestOrder(order));const ready={...order,archive:{archiveId:'a'},steps:{archive:{status:'success'}}};
|
|
const first=service.ingestOrder(ready),again=service.ingestOrder(ready);assert.equal(first.id,again.id);assert.equal(store.items()[0].brief,order.brief);assert.equal(store.pending(3,['L']).length,0);
|
|
service.syncOrder({...ready,status:'unknown',notification:{status:'unknown',batchId:'b'}});assert.equal(store.items()[0].status,'unknown');assert.equal(store.items()[0].batch_id,'b');
|
|
});
|