实现报销材料连续预览(07-27-yang-jun-reimbursement-readiness)
这个提交包含在:
@@ -0,0 +1,25 @@
|
||||
const { mapInvoiceDocumentMeta } = require("../../../src/services/invoiceDocumentMeta");
|
||||
|
||||
describe("invoice document metadata", () => {
|
||||
it("exposes only supported document categories and a bounded subtype", () => {
|
||||
expect(mapInvoiceDocumentMeta({
|
||||
ocr_result: {
|
||||
result_json: {
|
||||
documentCategory: " electronic_train_ticket ",
|
||||
documentSubtype: `ElectronicTrainTicketFull${"x".repeat(80)}`,
|
||||
raw: { sensitive: true },
|
||||
},
|
||||
},
|
||||
})).toEqual({
|
||||
documentCategory: "electronic_train_ticket",
|
||||
documentSubtype: `ElectronicTrainTicketFull${"x".repeat(39)}`,
|
||||
});
|
||||
});
|
||||
|
||||
it("fails closed for unknown, blank, or malformed OCR metadata", () => {
|
||||
expect(mapInvoiceDocumentMeta({
|
||||
ocr_result: { result_json: { documentCategory: "unknown_invoice", documentSubtype: " " } },
|
||||
})).toEqual({ documentCategory: null, documentSubtype: null });
|
||||
expect(mapInvoiceDocumentMeta(null)).toEqual({ documentCategory: null, documentSubtype: null });
|
||||
});
|
||||
});
|
||||
在新工单中引用
屏蔽一个用户