forked from stellar/go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtransaction_envelope_test.go
53 lines (43 loc) · 1.31 KB
/
transaction_envelope_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
package build
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("TransactionEnvelope Mutators:", func() {
var (
subject TransactionEnvelopeBuilder
mut TransactionEnvelopeMutator
err error
)
BeforeEach(func() { subject = TransactionEnvelopeBuilder{} })
JustBeforeEach(func() { err = subject.Mutate(mut) })
Describe("TransactionBuilder", func() {
Context("that is valid", func() {
BeforeEach(func() {
var err error
mut, err = Transaction(Sequence{10})
Expect(err).NotTo(HaveOccurred())
})
It("succeeds", func() { Expect(err).NotTo(HaveOccurred()) })
It("sets the TX", func() { Expect(subject.E.Tx.SeqNum).To(BeEquivalentTo(10)) })
})
})
Describe("Sign", func() {
Context("with a valid key", func() {
BeforeEach(func() {
subject.MutateTX(SourceAccount{"SDOTALIMPAM2IV65IOZA7KZL7XWZI5BODFXTRVLIHLQZQCKK57PH5F3H"}, TestNetwork)
mut = Sign{"SDOTALIMPAM2IV65IOZA7KZL7XWZI5BODFXTRVLIHLQZQCKK57PH5F3H"}
})
It("succeeds", func() { Expect(err).NotTo(HaveOccurred()) })
It("adds a signature to the envelope", func() {
Expect(subject.E.Signatures).To(HaveLen(1))
})
})
Context("with an invalid key", func() {
BeforeEach(func() { mut = Sign{""} })
It("fails", func() {
Expect(err).To(HaveOccurred())
})
})
})
})