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

Function TestBalance_CommitInflightDebit

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

Source from the content-addressed store, hash-verified

357}
358
359func 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
384func TestBalance_CommitInflightCredit(t *testing.T) {
385 balance := &Balance{

Callers

nothing calls this directly

Calls 1

CommitInflightDebitMethod · 0.95

Tested by

no test coverage detected