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

Function TestApplyTransaction_Debit

database/balance_test.go:2040–2063  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2038}
2039
2040func TestApplyTransaction_Debit(t *testing.T) {
2041 balanceID := "bln_test123"
2042 creditBalance := big.NewInt(1000)
2043 debitBalance := big.NewInt(500)
2044
2045 txn := struct {
2046 PreciseAmount string
2047 Source string
2048 Destination string
2049 CreatedAt time.Time
2050 EffectiveDate time.Time
2051 }{
2052 PreciseAmount: "100",
2053 Source: balanceID,
2054 Destination: "other_balance",
2055 CreatedAt: time.Now(),
2056 EffectiveDate: time.Now(),
2057 }
2058
2059 newCredit, newDebit, err := applyTransaction(txn, balanceID, creditBalance, debitBalance)
2060 assert.NoError(t, err)
2061 assert.Equal(t, int64(1000), newCredit.Int64())
2062 assert.Equal(t, int64(600), newDebit.Int64())
2063}
2064
2065func TestApplyTransaction_Credit(t *testing.T) {
2066 balanceID := "bln_test123"

Callers

nothing calls this directly

Calls 1

applyTransactionFunction · 0.85

Tested by

no test coverage detected