forked from hiero-ledger/hiero-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
account_balance_query_test.go
48 lines (36 loc) · 1.11 KB
/
account_balance_query_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package hedera
import (
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
func TestSerializeAccountBalanceQuery(t *testing.T) {
query := NewAccountBalanceQuery().
SetAccountID(AccountID{Account: 3}).
Query
assert.Equal(t, `cryptogetAccountBalance:{header:{}accountID:{accountNum:3}}`, strings.ReplaceAll(query.pb.String(), " ", ""))
}
func TestAccountBalanceQuery_Execute(t *testing.T) {
client := newTestClient(t)
_, err := NewAccountBalanceQuery().
SetAccountID(client.GetOperatorAccountID()).
Execute(client)
assert.NoError(t, err)
}
func TestAccountBalanceQueryCost_Execute(t *testing.T) {
client := newTestClient(t)
balance := NewAccountBalanceQuery().
SetAccountID(client.GetOperatorAccountID())
cost, err := balance.GetCost(client)
assert.NoError(t, err)
_, err = balance.SetMaxQueryPayment(cost).
Execute(client)
assert.NoError(t, err)
}
func Test_AccountBalance_NoAccount(t *testing.T) {
client := newTestClient(t)
_, err := NewAccountBalanceQuery().
Execute(client)
assert.Error(t, err)
assert.True(t, err.Error() == "exceptional precheck status INVALID_ACCOUNT_ID")
}