(t *testing.T)
| 1106 | } |
| 1107 | |
| 1108 | func TestPrepareLineageOutbox(t *testing.T) { |
| 1109 | ctx := context.Background() |
| 1110 | |
| 1111 | tests := []struct { |
| 1112 | name string |
| 1113 | txn *model.Transaction |
| 1114 | sourceBalance *model.Balance |
| 1115 | destinationBalance *model.Balance |
| 1116 | expectOutbox bool |
| 1117 | expectedType string |
| 1118 | expectedProvider string |
| 1119 | }{ |
| 1120 | { |
| 1121 | name: "No lineage tracking - returns nil", |
| 1122 | txn: &model.Transaction{ |
| 1123 | TransactionID: "txn_123", |
| 1124 | PreciseAmount: big.NewInt(10000), |
| 1125 | }, |
| 1126 | sourceBalance: &model.Balance{ |
| 1127 | BalanceID: "bln_source", |
| 1128 | TrackFundLineage: false, |
| 1129 | }, |
| 1130 | destinationBalance: &model.Balance{ |
| 1131 | BalanceID: "bln_dest", |
| 1132 | TrackFundLineage: false, |
| 1133 | }, |
| 1134 | expectOutbox: false, |
| 1135 | }, |
| 1136 | { |
| 1137 | name: "Credit only - destination tracks lineage with provider", |
| 1138 | txn: &model.Transaction{ |
| 1139 | TransactionID: "txn_123", |
| 1140 | PreciseAmount: big.NewInt(10000), |
| 1141 | Currency: "USD", |
| 1142 | Precision: 100, |
| 1143 | Reference: "ref_123", |
| 1144 | MetaData: map[string]interface{}{ |
| 1145 | "LEDGERFORGE_LINEAGE_PROVIDER": "stripe", |
| 1146 | }, |
| 1147 | }, |
| 1148 | sourceBalance: &model.Balance{ |
| 1149 | BalanceID: "bln_source", |
| 1150 | TrackFundLineage: false, |
| 1151 | }, |
| 1152 | destinationBalance: &model.Balance{ |
| 1153 | BalanceID: "bln_dest", |
| 1154 | TrackFundLineage: true, |
| 1155 | }, |
| 1156 | expectOutbox: true, |
| 1157 | expectedType: "credit", |
| 1158 | expectedProvider: "stripe", |
| 1159 | }, |
| 1160 | { |
| 1161 | name: "Debit only - source tracks lineage", |
| 1162 | txn: &model.Transaction{ |
| 1163 | TransactionID: "txn_123", |
| 1164 | PreciseAmount: big.NewInt(10000), |
| 1165 | Currency: "USD", |
nothing calls this directly
no test coverage detected