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

Function TestTransaction_HashTxn

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

Source from the content-addressed store, hash-verified

25}
26
27func TestTransaction_HashTxn(t *testing.T) {
28 txn := &Transaction{
29 Amount: 100.0,
30 Reference: "ref123",
31 Currency: "USD",
32 Source: "source_account",
33 Destination: "dest_account",
34 }
35 data := "100.000000ref123USDsource_accountdest_account"
36 expectedHash := sha256.Sum256([]byte(data))
37 expectedHashStr := hex.EncodeToString(expectedHash[:])
38
39 txnHash := txn.HashTxn()
40 assert.Equal(t, expectedHashStr, txnHash)
41}
42
43func TestCompare(t *testing.T) {
44 value := big.NewInt(10)

Callers

nothing calls this directly

Calls 1

HashTxnMethod · 0.95

Tested by

no test coverage detected