You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
import { describe , expect , it } from "vitest" ;
import { buildMailIntent } from "@/services/parse/mail-intent" ;
describe ( "mail-intent structured facts" , ( ) = > {
it ( "label mail → short narrative + discrete facts, no body dump" , ( ) = > {
const intent = buildMailIntent ( {
mailType : "INSTRUCTION_LABEL" ,
subject : "原箱号YT2604021091=FBA199R49LD6-MDW2=76件换标操作指令" ,
body : ` 【样例还原】
发件人: a@b.com
${ "超长正文" . repeat ( 40 ) }
柜号 WHSU6227512 仓库 HIA1 ` ,
filenames : [ "换标清单.xlsx" , "覆盖贴.pdf" ] ,
shipments : [
{
row_index : 1 ,
row_status : "VALID" ,
F_ShipmentID : "YT2604021091" ,
F_FBAID : "FBA199R49LD6" ,
F_FBACode : "MDW2" ,
F_CTNS : 76 ,
F_Remark : "304PCS" ,
} ,
] ,
containerNo : "WHSU6227512" ,
} ) ;
expect ( intent . narrative . length ) . toBeLessThan ( 80 ) ;
expect ( intent . content_hint . length ) . toBeLessThanOrEqual ( 48 ) ;
expect ( intent . facts . some ( ( f ) = > f . label === "柜号" ) ) . toBe ( true ) ;
expect ( intent . facts . some ( ( f ) = > f . label === "派送仓" && f . value === "MDW2" ) ) . toBe (
true ,
) ;
expect ( intent . attachment_role ) . not . toMatch ( /换标清单\.xlsx/ ) ;
expect ( intent . operation ) . not . toMatch ( /【样例还原】/ ) ;
} ) ;
} ) ;