修复报销票据门禁提示与 OCR 降级(08-30-b2-submit-error-ocr-fallback)
这个提交包含在:
@@ -0,0 +1,42 @@
|
||||
const {
|
||||
INVOICE_AMOUNT_EVIDENCE_STATUS,
|
||||
resolveInvoiceAmountEvidence,
|
||||
} = require("../../../src/services/invoiceAmountEvidence");
|
||||
|
||||
describe("resolveInvoiceAmountEvidence", () => {
|
||||
it("treats a present amount, including zero, as verified", () => {
|
||||
expect(resolveInvoiceAmountEvidence({
|
||||
totalAmount: "0.00",
|
||||
ocrAttempts: 0,
|
||||
ocrLastRequestedAt: null,
|
||||
ocrCompletedAt: null,
|
||||
ocrLastError: null,
|
||||
})).toBe(INVOICE_AMOUNT_EVIDENCE_STATUS.verified);
|
||||
});
|
||||
|
||||
it("requires manual review when no amount and no OCR execution evidence exist", () => {
|
||||
expect(resolveInvoiceAmountEvidence({
|
||||
totalAmount: null,
|
||||
ocrAttempts: 0,
|
||||
ocrLastRequestedAt: null,
|
||||
ocrCompletedAt: null,
|
||||
ocrLastError: null,
|
||||
})).toBe(INVOICE_AMOUNT_EVIDENCE_STATUS.manualReview);
|
||||
});
|
||||
|
||||
it.each([
|
||||
["attempt count", { ocrAttempts: 1 }],
|
||||
["request time", { ocrLastRequestedAt: new Date("2026-08-30T10:00:00.000Z") }],
|
||||
["completion time", { ocrCompletedAt: new Date("2026-08-30T10:00:01.000Z") }],
|
||||
["last error", { ocrLastError: "amount_missing" }],
|
||||
])("treats missing amount with %s as OCR failed", (_label, evidence) => {
|
||||
expect(resolveInvoiceAmountEvidence({
|
||||
totalAmount: null,
|
||||
ocrAttempts: 0,
|
||||
ocrLastRequestedAt: null,
|
||||
ocrCompletedAt: null,
|
||||
ocrLastError: null,
|
||||
...evidence,
|
||||
})).toBe(INVOICE_AMOUNT_EVIDENCE_STATUS.ocrFailed);
|
||||
});
|
||||
});
|
||||
在新工单中引用
屏蔽一个用户