(t *testing.T)
| 2088 | } |
| 2089 | |
| 2090 | func TestApplyTransaction_InvalidAmount(t *testing.T) { |
| 2091 | balanceID := "bln_test123" |
| 2092 | creditBalance := big.NewInt(1000) |
| 2093 | debitBalance := big.NewInt(500) |
| 2094 | |
| 2095 | txn := struct { |
| 2096 | PreciseAmount string |
| 2097 | Source string |
| 2098 | Destination string |
| 2099 | CreatedAt time.Time |
| 2100 | EffectiveDate time.Time |
| 2101 | }{ |
| 2102 | PreciseAmount: "invalid_amount", |
| 2103 | Source: balanceID, |
| 2104 | Destination: "other_balance", |
| 2105 | CreatedAt: time.Now(), |
| 2106 | EffectiveDate: time.Now(), |
| 2107 | } |
| 2108 | |
| 2109 | _, _, err := applyTransaction(txn, balanceID, creditBalance, debitBalance) |
| 2110 | assert.Error(t, err) |
| 2111 | apiErr, ok := err.(apierror.APIError) |
| 2112 | assert.True(t, ok) |
| 2113 | assert.Equal(t, apierror.ErrInternalServer, apiErr.Code) |
| 2114 | } |
| 2115 | |
| 2116 | func TestCalculateBalanceFromTransactions_Success(t *testing.T) { |
| 2117 | db, mock, err := sqlmock.New() |
nothing calls this directly
no test coverage detected