From c6888ee12044388b9510bde59c8a1001012d4c03 Mon Sep 17 00:00:00 2001 From: ionutboangiu Date: Thu, 4 Mar 2021 15:26:19 +0200 Subject: [PATCH] Test AccountProfiles func in utils/accountprofile.go --- utils/accountprofile_test.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/utils/accountprofile_test.go b/utils/accountprofile_test.go index 8e47fd04f..4a560e443 100644 --- a/utils/accountprofile_test.go +++ b/utils/accountprofile_test.go @@ -438,3 +438,38 @@ func TestAPSort(t *testing.T) { t.Errorf("\nReceived: <%+v>, \nExpected: <%+v>", ToJSON(apS), ToJSON(expected)) } } + +func TestAPAccountProfiles(t *testing.T) { + + apS := AccountProfilesWithWeight{ + { + AccountProfile: &AccountProfile{ + Tenant: "testTenant", + ID: "testID", + FilterIDs: []string{"testFID1", "testFID2"}, + ActivationInterval: &ActivationInterval{ + ActivationTime: time.Date(2020, time.April, 12, 0, 0, 0, 0, time.UTC), + ExpiryTime: time.Date(2020, time.April, 12, 10, 0, 0, 0, time.UTC), + }, + Weights: nil, + Balances: map[string]*Balance{ + "testBalance": &Balance{ + ID: "testBalance", + Type: MetaAbstract, + Units: &Decimal{decimal.New(0, 0)}, + }, + }, + }, + Weight: 15, + LockID: "testString", + }, + } + expected := []*AccountProfile{ + apS[0].AccountProfile, + } + received := apS.AccountProfiles() + + if !reflect.DeepEqual(received, expected) { + t.Errorf("\nReceived: <%+v>,\nExpected: <%+v>", ToJSON(received), ToJSON(expected)) + } +}