mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-21 23:28:44 +05:00
Test for fsArray
This commit is contained in:
committed by
Dan Christian Bogos
parent
1ad9b01a20
commit
56e6f6f7ef
@@ -637,6 +637,48 @@ func TestSliceAsFsArray(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestSliceAsArraySortingParameter(t *testing.T) {
|
||||
eSplrs := engine.SortedRoutesList{{
|
||||
ProfileID: "ACNT_1003",
|
||||
Sorting: utils.MetaWeight,
|
||||
Routes: []*engine.SortedRoute{
|
||||
{
|
||||
RouteID: "rt1",
|
||||
SortingData: map[string]interface{}{
|
||||
"Weight": 10.0,
|
||||
},
|
||||
},
|
||||
{
|
||||
RouteID: "rt2",
|
||||
SortingData: map[string]interface{}{
|
||||
"Weight": 20.0,
|
||||
},
|
||||
},
|
||||
},
|
||||
}, {
|
||||
ProfileID: "ACNT_1004",
|
||||
Sorting: utils.MetaWeight,
|
||||
Routes: []*engine.SortedRoute{
|
||||
{
|
||||
RouteID: "RT1",
|
||||
SortingData: map[string]interface{}{
|
||||
"Weight": 10.0,
|
||||
},
|
||||
},
|
||||
{
|
||||
RouteID: "RT2",
|
||||
SortingData: map[string]interface{}{
|
||||
"Weight": 10.0,
|
||||
},
|
||||
},
|
||||
},
|
||||
}}
|
||||
expFs := "ARRAY::4|:rt1|:rt2|:RT1|:RT2"
|
||||
if fsArray := SliceAsFsArray(eSplrs.RoutesWithParams()); expFs != fsArray {
|
||||
t.Errorf("Expected %+v, received %+v", expFs, fsArray)
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure processing of the hangup event produces the same output as FS-JSON CDR
|
||||
func TestSyncFsEventWithJsonCdr(t *testing.T) {
|
||||
body := []byte(`
|
||||
|
||||
Reference in New Issue
Block a user