Files
spend-sparrow/service/money_test.go
Tim Wundenberg 511c4ca22b
All checks were successful
Build Docker Image / Build-Docker-Image (push) Successful in 7m51s
Build and Push Docker Image / Build-And-Push-Docker-Image (push) Successful in 3m10s
feat(account): #49 replace group_id with user_id, as data sharing is a whole new complicated topic
2025-05-08 13:20:59 +02:00

81 lines
1.7 KiB
Go

package service
import (
"testing"
)
func TestMoneyCalculation(t *testing.T) {
t.Parallel()
t.Run("should calculate correct oink balance", func(t *testing.T) {
// t.Parallel()
//
// underTest := NewMoneyImpl()
//
// // GIVEN
// timestamp := time.Date(2020, 01, 01, 0, 0, 0, 0, time.UTC)
//
// userId := uuid.New()
//
// account := types.Account{
// Id: uuid.New(),
// UserId: userId,
//
// Type: "Bank",
// Name: "Bank",
//
// CurrentBalance: 0,
// LastTransaction: time.Time{},
// OinkBalance: 0,
// }
//
// // The PiggyBank is a fictional account. The money it "holds" is actually in the Account
// piggyBank := types.PiggyBank{
// Id: uuid.New(),
// UserId: userId,
//
// AccountId: account.Id,
// Name: "Car",
//
// CurrentBalance: 0,
// }
//
// savingsPlan := types.SavingsPlan{
// Id: uuid.New(),
// UserId: userId,
// PiggyBankId: piggyBank.Id,
//
// MonthlySaving: 10,
//
// ValidFrom: timestamp,
// }
//
// transaction1 := types.Transaction{
// Id: uuid.New(),
// UserId: userId,
//
// AccountId: account.Id,
//
// Value: 20,
// Timestamp: timestamp,
// }
//
// transaction2 := types.Transaction{
// Id: uuid.New(),
// UserId: userId,
//
// AccountId: account.Id,
// PiggyBankId: &piggyBank.Id,
//
// Value: -1,
// Timestamp: timestamp.Add(1 * time.Hour),
// }
//
// // WHEN
// actual, err := underTest.CalculateAllBalancesInTime(account, piggyBank, savingsPlan, []types.Transaction{transaction1, transaction2})
//
// // THEN
// assert.Nil(t, err)
// assert.ElementsMatch(t, expected, actual)
})
}