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

Function TestUpdateBalances

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

Source from the content-addressed store, hash-verified

472}
473
474func TestUpdateBalances(t *testing.T) {
475 sourceBalance := &Balance{
476 Balance: big.NewInt(1000),
477 }
478 destinationBalance := &Balance{
479 Balance: big.NewInt(500),
480 }
481 txn := &Transaction{
482 Amount: 200.0,
483 Precision: 1,
484 }
485 err := UpdateBalances(txn, sourceBalance, destinationBalance)
486 assert.NoError(t, err)
487
488 // Source balance should decrease
489 assert.Equal(t, big.NewInt(-200), sourceBalance.Balance)
490 // Destination balance should increase
491 assert.Equal(t, big.NewInt(200), destinationBalance.Balance)
492}
493
494func TestUpdateBalances_WithRate(t *testing.T) {
495 sourceBalance := &Balance{

Callers

nothing calls this directly

Calls 1

UpdateBalancesFunction · 0.85

Tested by

no test coverage detected