(t *testing.T)
| 492 | } |
| 493 | |
| 494 | func TestUpdateBalances_WithRate(t *testing.T) { |
| 495 | sourceBalance := &Balance{ |
| 496 | Balance: big.NewInt(0), |
| 497 | } |
| 498 | destinationBalance := &Balance{ |
| 499 | Balance: big.NewInt(0), |
| 500 | } |
| 501 | |
| 502 | txn := &Transaction{ |
| 503 | Amount: 100.0, |
| 504 | AllowOverdraft: true, |
| 505 | Precision: 100, // Will make precise amount 10000 |
| 506 | Rate: 1.5, // Should make destination receive 15000 |
| 507 | } |
| 508 | |
| 509 | err := UpdateBalances(txn, sourceBalance, destinationBalance) |
| 510 | assert.NoError(t, err) |
| 511 | |
| 512 | // Source balance should decrease by precise amount |
| 513 | assert.Equal(t, big.NewInt(-10000), sourceBalance.Balance) |
| 514 | // Destination balance should increase by rate-adjusted amount |
| 515 | assert.Equal(t, big.NewInt(15000), destinationBalance.Balance) |
| 516 | } |
| 517 | |
| 518 | func TestBalanceMonitor_CheckCondition(t *testing.T) { |
| 519 | balance := &Balance{ |
nothing calls this directly
no test coverage detected