forked from stellar/go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaccount_merge_test.go
67 lines (53 loc) · 1.55 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package build
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/stellar/go/xdr"
)
var _ = Describe("AccountMergeBuilder Mutators", func() {
var (
subject AccountMergeBuilder
mut interface{}
address = "GAXEMCEXBERNSRXOEKD4JAIKVECIXQCENHEBRVSPX2TTYZPMNEDSQCNQ"
bad = "foo"
)
JustBeforeEach(func() {
subject = AccountMergeBuilder{}
subject.Mutate(mut)
})
Describe("Destination", func() {
Context("using a valid stellar address", func() {
BeforeEach(func() { mut = Destination{address} })
It("succeeds", func() {
Expect(subject.Err).NotTo(HaveOccurred())
})
It("sets the destination to the correct xdr.AccountId", func() {
var aid xdr.AccountId
aid.SetAddress(address)
Expect(subject.Destination.Equals(aid)).To(BeTrue())
})
})
Context("using an invalid value", func() {
BeforeEach(func() { mut = Destination{bad} })
It("failed", func() { Expect(subject.Err).To(HaveOccurred()) })
})
})
Describe("SourceAccount", func() {
Context("using a valid stellar address", func() {
BeforeEach(func() { mut = SourceAccount{address} })
It("succeeds", func() {
Expect(subject.Err).NotTo(HaveOccurred())
})
It("sets the destination to the correct xdr.AccountId", func() {
var aid xdr.AccountId
aid.SetAddress(address)
Expect(subject.O.SourceAccount.Equals(aid)).To(BeTrue())
})
})
Context("using an invalid value", func() {
BeforeEach(func() { mut = SourceAccount{bad} })
It("failed", func() { Expect(subject.Err).To(HaveOccurred()) })
})
})
//
})