forked from stellar/go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
account_merge_test.go
43 lines (36 loc) · 1.18 KB
/
account_merge_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
package txnbuild
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestAccountMergeValidate(t *testing.T) {
kp0 := newKeypair0()
sourceAccount := NewSimpleAccount(kp0.Address(), int64(40385577484298))
accountMerge := AccountMerge{
Destination: "GBAV",
}
_, err := NewTransaction(
TransactionParams{
SourceAccount: &sourceAccount,
Operations: []Operation{&accountMerge},
Preconditions: Preconditions{TimeBounds: NewInfiniteTimeout()},
BaseFee: MinBaseFee,
},
)
if assert.Error(t, err) {
expected := "invalid address length"
assert.Contains(t, err.Error(), expected)
}
}
func TestAccountMergeRoundtrip(t *testing.T) {
accountMerge := AccountMerge{
SourceAccount: "GB7BDSZU2Y27LYNLALKKALB52WS2IZWYBDGY6EQBLEED3TJOCVMZRH7H",
Destination: "GB7BDSZU2Y27LYNLALKKALB52WS2IZWYBDGY6EQBLEED3TJOCVMZRH7H",
}
testOperationsMarshalingRoundtrip(t, []Operation{&accountMerge}, false)
accountMerge = AccountMerge{
SourceAccount: "MA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJVAAAAAAAAAAAAAJLK",
Destination: "GB7BDSZU2Y27LYNLALKKALB52WS2IZWYBDGY6EQBLEED3TJOCVMZRH7H",
}
testOperationsMarshalingRoundtrip(t, []Operation{&accountMerge}, true)
}