-
Notifications
You must be signed in to change notification settings - Fork 501
/
bump_sequence_test.go
43 lines (36 loc) · 1.15 KB
/
bump_sequence_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 TestBumpSequenceValidate(t *testing.T) {
kp1 := newKeypair1()
sourceAccount := NewSimpleAccount(kp1.Address(), int64(9606132444168199))
bumpSequence := BumpSequence{
BumpTo: -10,
}
_, err := NewTransaction(
TransactionParams{
SourceAccount: &sourceAccount,
Operations: []Operation{&bumpSequence},
Preconditions: Preconditions{TimeBounds: NewInfiniteTimeout()},
BaseFee: MinBaseFee,
},
)
if assert.Error(t, err) {
expected := "validation failed for *txnbuild.BumpSequence operation: Field: BumpTo, Error: amount can not be negative"
assert.Contains(t, err.Error(), expected)
}
}
func TestBumpSequenceRountrip(t *testing.T) {
bumpSequence := BumpSequence{
SourceAccount: "GB7BDSZU2Y27LYNLALKKALB52WS2IZWYBDGY6EQBLEED3TJOCVMZRH7H",
BumpTo: 10,
}
testOperationsMarshalingRoundtrip(t, []Operation{&bumpSequence}, false)
bumpSequence = BumpSequence{
SourceAccount: "MA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJVAAAAAAAAAAAAAJLK",
BumpTo: 10,
}
testOperationsMarshalingRoundtrip(t, []Operation{&bumpSequence}, true)
}