(t *testing.T)
| 357 | } |
| 358 | |
| 359 | func TestBalance_CommitInflightDebit(t *testing.T) { |
| 360 | balance := &Balance{ |
| 361 | InflightDebitBalance: big.NewInt(500), |
| 362 | DebitBalance: big.NewInt(200), |
| 363 | Balance: big.NewInt(1000), |
| 364 | InflightBalance: big.NewInt(500), |
| 365 | } |
| 366 | |
| 367 | txn := &Transaction{ |
| 368 | Amount: 300, |
| 369 | Precision: 1, |
| 370 | } |
| 371 | |
| 372 | balance.CommitInflightDebit(txn) |
| 373 | |
| 374 | // Expected: InflightDebitBalance should decrease by 300 |
| 375 | assert.Equal(t, big.NewInt(200), balance.InflightDebitBalance) |
| 376 | |
| 377 | // Expected: DebitBalance should increase by 300 |
| 378 | assert.Equal(t, big.NewInt(500), balance.DebitBalance) |
| 379 | |
| 380 | assert.Equal(t, big.NewInt(-500), balance.Balance) // with credit balance as 0 |
| 381 | assert.Equal(t, big.NewInt(-200), balance.InflightBalance) // with inflight credit balance as 0 |
| 382 | } |
| 383 | |
| 384 | func TestBalance_CommitInflightCredit(t *testing.T) { |
| 385 | balance := &Balance{ |
nothing calls this directly
no test coverage detected