package service import ( "testing" "household-book/model" ) func TestSourceKeyDoesNotDependOnWholeFile(t *testing.T) { a := model.ImportTransactionsRequest{Content: []byte("first export"), SourceKind: "wechat", BankName: "微信", CardType: "wechat"} b := model.ImportTransactionsRequest{Content: []byte("overlapping export"), SourceKind: "wechat", BankName: "微信", CardType: "wechat"} if sourceKey(a, "stable-trade-id") != sourceKey(b, "stable-trade-id") { t.Fatal("same transaction identity should deduplicate across different files") } }