mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-15 21:29:52 +05:00
Test BalancesAltered func in utils/accountprofile.go
This commit is contained in:
committed by
Dan Christian Bogos
parent
34a5c42019
commit
6af41544bc
@@ -265,3 +265,72 @@ func TestAPIBalanceAsBalance(t *testing.T) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestAccountProfileBalancesAlteredCompareLength(t *testing.T) {
|
||||
actPrf := &AccountProfile{
|
||||
Balances: map[string]*Balance{
|
||||
"testString": {},
|
||||
"testString2": {},
|
||||
},
|
||||
}
|
||||
|
||||
actBk := map[string]*decimal.Big{
|
||||
"testString": {},
|
||||
}
|
||||
|
||||
result := actPrf.BalancesAltered(actBk)
|
||||
if result != true {
|
||||
t.Errorf("\nExpected: <%+v>, \nReceived: <%+v>", true, result)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestAccountProfileBalancesAlteredCheckKeys(t *testing.T) {
|
||||
actPrf := &AccountProfile{
|
||||
Balances: map[string]*Balance{
|
||||
"testString": {},
|
||||
},
|
||||
}
|
||||
|
||||
actBk := map[string]*decimal.Big{
|
||||
"testString2": {},
|
||||
}
|
||||
|
||||
result := actPrf.BalancesAltered(actBk)
|
||||
if result != true {
|
||||
t.Errorf("\nExpected: <%+v>, \nReceived: <%+v>", true, result)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestAccountProfileBalancesAlteredCompareValues(t *testing.T) {
|
||||
actPrf := &AccountProfile{
|
||||
Balances: map[string]*Balance{
|
||||
"testString": {
|
||||
Units: &Decimal{decimal.New(1, 1)},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
actBk := map[string]*decimal.Big{
|
||||
"testString": {},
|
||||
}
|
||||
|
||||
result := actPrf.BalancesAltered(actBk)
|
||||
if result != true {
|
||||
t.Errorf("\nExpected: <%+v>, \nReceived: <%+v>", true, result)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestAccountProfileBalancesAlteredFalse(t *testing.T) {
|
||||
actPrf := &AccountProfile{}
|
||||
|
||||
actBk := AccountBalancesBackup{}
|
||||
|
||||
result := actPrf.BalancesAltered(actBk)
|
||||
if result != false {
|
||||
t.Errorf("\nExpected: <%+v>, \nReceived: <%+v>", false, result)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user