fixed get contributions

This commit is contained in:
bel
2023-10-27 08:55:45 -06:00
parent dfce352f9f
commit 037d0a5efc
3 changed files with 43 additions and 46 deletions

View File

@@ -61,30 +61,22 @@ func TestGetContributions(t *testing.T) {
if len(got) != 2 {
t.Error(len(got))
}
if len(got["a"]) != 2 {
if len(got["a"]) != 1 {
t.Error(len(got["a"]))
} else if len(got["a"][0]) != 1 {
} else if len(got["a"][0]) != 2 {
t.Error(got["a"])
} else if got["a"][0]["x"] != 1 {
} else if got["a"][0]["x"] != -1 {
t.Error(got["a"][0])
} else if got["a"][0]["y"] != 1 {
t.Error(got["a"][0])
} else if len(got["a"][1]) != 2 {
t.Error(got["a"][1])
} else if got["a"][1]["x"] != -1 {
t.Error(got["a"][1])
} else if got["a"][1]["y"] != 1 {
t.Error(got["a"][1])
}
if len(got["b"]) != 2 {
if len(got["b"]) != 1 {
t.Error(len(got["b"]))
} else if len(got["b"][0]) != 1 {
t.Error(got["b"])
} else if got["b"][0]["z"] != 1 {
} else if got["b"][0]["z"] != 3 {
t.Error(got["b"][0])
} else if len(got["b"][1]) != 1 {
t.Error(got["b"])
} else if got["b"][1]["z"] != 3 {
t.Error(got["b"][1])
}
}
@@ -94,7 +86,7 @@ func TestGetMonthlyContributionRate(t *testing.T) {
ledger.Balance{"x": 4},
ledger.Balance{"y": 3},
}
got := getMonthlyContributionRate(input, time.Hour*24*365/4)
got := getMonthlyContributionRate(input, time.Hour*24*365/4, "")
if len(got) != 2 {
t.Error(got)
}