Test AsDataProvider func in utils/cgrevent.go

This commit is contained in:
ionutboangiu
2021-03-05 13:32:56 +02:00
committed by Dan Christian Bogos
parent 1226258d7c
commit 76bdda67ab

View File

@@ -501,3 +501,27 @@ func TestCGREventOptAsDuration(t *testing.T) {
t.Errorf("\nReceived: <%+v>, \nExpected: <%+v>", received, expected)
}
}
func TestCGREventAsDataProvider(t *testing.T) {
ev := &CGREvent{
Opts: map[string]interface{}{
"testKey1": 13,
"testKey2": "testString1",
},
Event: map[string]interface{}{
"testKey1": 30,
"testKey2": "testString2",
},
}
expected := MapStorage{
MetaOpts: ev.Opts,
MetaReq: ev.Event,
}
received := ev.AsDataProvider()
if !reflect.DeepEqual(expected, received) {
t.Errorf("\nReceived: <%+v>, \nExpected: <%+v>", received, expected)
}
}