Contributions to AutoContributions

This commit is contained in:
Bel LaPointe
2023-10-27 18:50:44 -06:00
parent 7d872ca92a
commit 6d97ce773b
5 changed files with 26 additions and 25 deletions

View File

@@ -80,28 +80,28 @@ func TestGetContributions(t *testing.T) {
}
}
func TestGetMonthlyContributionRate(t *testing.T) {
func TestGetMonthlyAutoContributionRate(t *testing.T) {
input := []ledger.Balance{
ledger.Balance{"x": 2},
ledger.Balance{"x": 4},
ledger.Balance{"y": 3},
}
got := getMonthlyContributionRate(input, time.Hour*24*365/4)
got := getMonthlyAutoContributionRate(input, time.Hour*24*365/4)
if len(got) != 2 {
t.Error(got)
}
if got["x"] != 2 {
if got["x"] != 4 {
t.Error(got["x"])
}
if got["y"] != 1 {
if got["y"] != 3 {
t.Error(got["y"])
}
}
func TestNewContributionPredictor(t *testing.T) {
func TestNewAutoContributionPredictor(t *testing.T) {
name := "x"
currency := ledger.USD
predictor := newContributionPredictor(map[string]ledger.Balance{
predictor := newAutoContributionPredictor(map[string]ledger.Balance{
name: {currency: 10},
"y": {"XYZ": 3},
})