mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Test NewDefaultBalance func in utils/accountprofile.go
This commit is contained in:
committed by
Dan Christian Bogos
parent
60b23adb83
commit
1be12d891c
@@ -373,3 +373,38 @@ func TestAP_AccountBalancesBackup(t *testing.T) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestAPNewDefaultBalance(t *testing.T) {
|
||||
|
||||
const torFltr = "*string:~*req.ToR:"
|
||||
id := "testID"
|
||||
|
||||
expected := &Balance{
|
||||
ID: id,
|
||||
Type: MetaConcrete,
|
||||
Units: NewDecimal(0, 0),
|
||||
CostIncrements: []*CostIncrement{
|
||||
{
|
||||
FilterIDs: []string{torFltr + MetaVoice},
|
||||
Increment: NewDecimal(int64(time.Second), 0),
|
||||
RecurrentFee: NewDecimal(0, 0),
|
||||
},
|
||||
{
|
||||
FilterIDs: []string{torFltr + MetaData},
|
||||
Increment: NewDecimal(1024*1024, 0),
|
||||
RecurrentFee: NewDecimal(0, 0),
|
||||
},
|
||||
{
|
||||
FilterIDs: []string{torFltr + MetaSMS},
|
||||
Increment: NewDecimal(1, 0),
|
||||
RecurrentFee: NewDecimal(0, 0),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
received := NewDefaultBalance(id)
|
||||
|
||||
if !reflect.DeepEqual(received, expected) {
|
||||
t.Errorf("\nReceived: <%+v>,\nExpected: <%+v>", received, expected)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user