MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / TestUpdateBalances_WithRate

Function TestUpdateBalances_WithRate

model/model_test.go:494–516  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

492}
493
494func 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
518func TestBalanceMonitor_CheckCondition(t *testing.T) {
519 balance := &Balance{

Callers

nothing calls this directly

Calls 1

UpdateBalancesFunction · 0.85

Tested by

no test coverage detected