Test AccountBalancesBackup func in utils/accountprofile.go

This commit is contained in:
ionutboangiu
2021-03-03 13:50:49 +02:00
committed by Dan Christian Bogos
parent 14f3d31801
commit 9fc24e6a1a

View File

@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package utils
import (
"fmt"
"reflect"
"testing"
"time"
@@ -355,3 +356,22 @@ func TestAP_RestoreFromBackup(t *testing.T) {
}
}
}
func TestAP_AccountBalancesBackup(t *testing.T) {
actPrf := &AccountProfile{
Balances: map[string]*Balance{
"testKey": {
Units: &Decimal{decimal.New(1234, 3)},
},
},
}
actBk := actPrf.AccountBalancesBackup()
for key, value := range actBk {
if actPrf.Balances[key].Units.Big.Cmp(value) != 0 {
fmt.Println(actPrf.Balances[key].Units.Big, value)
t.Errorf("\ngot: <%+v>, \nwant: <%+v>", value, actPrf.Balances[key].Units.Big)
}
}
}