delta.Transaction export field

main
bel 2024-07-20 09:27:08 -06:00
parent 666965042a
commit ddc95c9054
5 changed files with 10 additions and 10 deletions

View File

@ -15,7 +15,7 @@ type Delta struct {
Currency Currency
Description string
isSet bool
transaction string
Transaction string
}
func newDelta(transaction string, d, desc, name string, v float64, c string, isSet bool) Delta {
@ -26,7 +26,7 @@ func newDelta(transaction string, d, desc, name string, v float64, c string, isS
Currency: Currency(c),
Description: desc,
isSet: isSet,
transaction: transaction,
Transaction: transaction,
}
}

View File

@ -8,8 +8,8 @@ func TestDelta(t *testing.T) {
d := "2099-08-07"
delta := newDelta("x", d, "", "name", 34.56, "$", false)
if delta.transaction != "x" {
t.Error(delta.transaction)
if delta.Transaction != "x" {
t.Error(delta.Transaction)
}
if delta.Date != d {
t.Error(delta.Date)

View File

@ -37,7 +37,7 @@ func (files Files) Amend(old, now Delta) error {
var transaction transaction
for _, xaction := range xactions {
if xaction.name != old.transaction {
if xaction.name != old.Transaction {
continue
}
transaction = xaction

View File

@ -146,7 +146,7 @@ func TestFileAmend(t *testing.T) {
} else if deltas, err := files.Deltas(); err != nil {
t.Fatal(err)
} else if filtered := deltas.Like(func(d Delta) bool {
c.old.transaction = d.transaction
c.old.Transaction = d.Transaction
return d == c.old
}); len(filtered) != 1 {
t.Fatalf("input %s didnt include old %+v in %+v", c.from, c.old, deltas)
@ -424,10 +424,10 @@ func TestFileDeltas(t *testing.T) {
if i >= len(deltas) {
break
}
if deltas[i].transaction == "" {
t.Error(deltas[i].transaction)
if deltas[i].Transaction == "" {
t.Error(deltas[i].Transaction)
}
deltas[i].transaction = ""
deltas[i].Transaction = ""
if want[i] != deltas[i] {
t.Errorf("[%d] \n\twant=%s, \n\t got=%s", i, want[i].Debug(), deltas[i].Debug())
}

View File

@ -10,7 +10,7 @@ type Likes []Like
func LikeTransaction(delta Delta) Like {
return func(d Delta) bool {
return d.transaction == delta.transaction
return d.Transaction == delta.Transaction
}
}