diff --git a/utils/apitpdata_test.go b/utils/apitpdata_test.go index f8c93de19..6aac4a125 100644 --- a/utils/apitpdata_test.go +++ b/utils/apitpdata_test.go @@ -18,6 +18,7 @@ along with this program. If not, see package utils import ( + "fmt" "reflect" "strings" "testing" @@ -1115,3 +1116,39 @@ func TestStartTimeError(t *testing.T) { t.Errorf("Expected , received <%+v>", err) } } + +func TestUsageMinute(t *testing.T) { + testCostEventStruct := &ArgsCostForEvent{ + RateProfileIDs: []string{"123", "456", "789"}, + CGREventWithOpts: &CGREventWithOpts{ + Opts: map[string]interface{}{}, + CGREvent: &CGREvent{ + Tenant: "*req.CGRID", + ID: "", + Event: map[string]interface{}{}, + }, + }, + } + if result, err := testCostEventStruct.Usage(); err != nil { + t.Errorf("Expected , received <%+v>", err) + } else if !reflect.DeepEqual(result, time.Minute) { + t.Errorf("Expected <%+v> , received <%+v>", time.Minute, result) + } +} + +func TestUsage(t *testing.T) { + testCostEventStruct := &ArgsCostForEvent{ + RateProfileIDs: []string{"123", "456", "789"}, + CGREventWithOpts: &CGREventWithOpts{ + Opts: map[string]interface{}{"*ratesStartTime": "start"}, + CGREvent: &CGREvent{ + Tenant: "*req.CGRID", + ID: "", + Event: map[string]interface{}{}, + }, + }, + } + result, err := testCostEventStruct.Usage() + fmt.Println(result) + fmt.Println(err) +}