更新打印接口回归断言以匹配自动打印记录

This commit is contained in:
summer committed 2026-12-04 03:30:08 +08:00
1 parent c08969b876
commit 8a3e8ed547
1 file changed
+1 -1
+1 -1
View File
@@ -99,6 +99,6 @@ test('HTTP内部字段保存每克料价,客户公开接口与打印页隔离
const internal=await (await call('/api/orders/'+id)).json();assert.equal(internal.lines[0].costParts.material,182654);assert.deepEqual(internal.lines[0].costMaterial,{mode:'gram',rate:91327});assert.equal(internal.profit,37346); const internal=await (await call('/api/orders/'+id)).json();assert.equal(internal.lines[0].costParts.material,182654);assert.deepEqual(internal.lines[0].costMaterial,{mode:'gram',rate:91327});assert.equal(internal.profit,37346);
const publicResponse=await call('/api/orders/'+id+'/public');assert.equal(publicResponse.status,200);const customer=await publicResponse.json(),json=JSON.stringify(customer); const publicResponse=await call('/api/orders/'+id+'/public');assert.equal(publicResponse.status,200);const customer=await publicResponse.json(),json=JSON.stringify(customer);
for(const key of ['costMaterial','costParts','costLabor','payer','profit','costDue'])assert.ok(!json.includes('"'+key+'"')); for(const key of ['costMaterial','costParts','costLabor','payer','profit','costDue'])assert.ok(!json.includes('"'+key+'"'));
const printResponse=await call('/print/'+id);assert.equal(printResponse.status,200);const html=await printResponse.text();assert.match(html,/id="confirm-document-print"/);assert.equal(html.replace(/<span id="document-print-state"[\s\S]*?(?=<button id="print")/,''),receipt(customer)); const printResponse=await call('/print/'+id);assert.equal(printResponse.status,200);const html=await printResponse.text();assert.doesNotMatch(html,/id="confirm-document-print"/);assert.match(html,/id="retry-document-print"/);assert.equal(html.replace(/<span id="document-print-state"[\s\S]*?(?=<button id="print")/,''),receipt(customer));
for(const secret of ['costMaterial','料费成本','进货料价','913.27','1826.54','373.46'])assert.ok(!html.includes(secret)); for(const secret of ['costMaterial','料费成本','进货料价','913.27','1826.54','373.46'])assert.ok(!html.includes(secret));
}); });