(t *testing.T)
| 2063 | } |
| 2064 | |
| 2065 | func TestApplyTransaction_Credit(t *testing.T) { |
| 2066 | balanceID := "bln_test123" |
| 2067 | creditBalance := big.NewInt(1000) |
| 2068 | debitBalance := big.NewInt(500) |
| 2069 | |
| 2070 | txn := struct { |
| 2071 | PreciseAmount string |
| 2072 | Source string |
| 2073 | Destination string |
| 2074 | CreatedAt time.Time |
| 2075 | EffectiveDate time.Time |
| 2076 | }{ |
| 2077 | PreciseAmount: "200", |
| 2078 | Source: "other_balance", |
| 2079 | Destination: balanceID, |
| 2080 | CreatedAt: time.Now(), |
| 2081 | EffectiveDate: time.Now(), |
| 2082 | } |
| 2083 | |
| 2084 | newCredit, newDebit, err := applyTransaction(txn, balanceID, creditBalance, debitBalance) |
| 2085 | assert.NoError(t, err) |
| 2086 | assert.Equal(t, int64(1200), newCredit.Int64()) |
| 2087 | assert.Equal(t, int64(500), newDebit.Int64()) |
| 2088 | } |
| 2089 | |
| 2090 | func TestApplyTransaction_InvalidAmount(t *testing.T) { |
| 2091 | balanceID := "bln_test123" |
nothing calls this directly
no test coverage detected