Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ignite
GitHub Repository: ignite/cli
Path: blob/main/integration/ibc/cmd_ibc_test.go
1007 views
1
//go:build !relayer
2
3
package ibc_test
4
5
import (
6
"testing"
7
8
envtest "github.com/ignite/cli/v29/integration"
9
)
10
11
func TestCreateModuleWithIBC(t *testing.T) {
12
var (
13
env = envtest.New(t)
14
app = env.ScaffoldApp("github.com/test/blogibc")
15
)
16
17
app.Scaffold(
18
"create an IBC module",
19
false,
20
"module", "foo", "--ibc", "--require-registration",
21
)
22
23
app.Scaffold(
24
"create an IBC module with custom path",
25
false,
26
"module",
27
"appPath",
28
"--ibc",
29
"--require-registration",
30
"--path",
31
"./blogibc",
32
)
33
34
app.Scaffold(
35
"create a type in an IBC module",
36
false,
37
"list", "user", "email", "--module", "foo",
38
)
39
40
app.Scaffold(
41
"create an IBC module with an ordered channel",
42
false,
43
"module",
44
"orderedfoo",
45
"--ibc",
46
"--ordering",
47
"ordered",
48
"--require-registration",
49
)
50
51
app.Scaffold(
52
"create an IBC module with an unordered channel",
53
false,
54
"module",
55
"unorderedfoo",
56
"--ibc",
57
"--ordering",
58
"unordered",
59
"--require-registration",
60
)
61
62
app.Scaffold(
63
"create a non IBC module",
64
false,
65
"module", "non_ibc", "--require-registration",
66
)
67
68
app.Scaffold(
69
"create an IBC module with dependencies",
70
false,
71
"module",
72
"with_dep",
73
"--ibc",
74
"--dep",
75
"auth,bank,staking,slashing",
76
"--require-registration",
77
)
78
79
app.EnsureSteady()
80
}
81
82
func TestCreateIBCPacket(t *testing.T) {
83
var (
84
env = envtest.New(t)
85
app = env.ScaffoldApp("github.com/test/blogibcb")
86
)
87
88
app.Scaffold(
89
"create an IBC module",
90
false,
91
"module", "foo", "--ibc", "--require-registration",
92
)
93
94
app.Scaffold(
95
"create a packet",
96
false,
97
"packet",
98
"bar",
99
"text",
100
"texts:strings",
101
"--module",
102
"foo",
103
"--ack",
104
"foo:string,bar:int,baz:bool",
105
)
106
107
app.Scaffold(
108
"should prevent creating a packet with no module specified",
109
true,
110
"packet", "bar", "text",
111
)
112
113
app.Scaffold(
114
"should prevent creating a packet in a non existent module",
115
true,
116
"packet", "bar", "text", "--module", "nomodule",
117
)
118
119
app.Scaffold(
120
"should prevent creating an existing packet",
121
true,
122
"packet", "bar", "post", "--module", "foo",
123
)
124
125
app.Scaffold(
126
"create a packet with custom type fields",
127
false,
128
"packet",
129
"ticket",
130
"numInt:int",
131
"numsInt:array.int",
132
"numsIntAlias:ints",
133
"numUint:uint",
134
"numsUint:array.uint",
135
"numsUintAlias:uints",
136
"textString:string",
137
"textStrings:array.string",
138
"textStringsAlias:strings",
139
"victory:bool",
140
"textCoin:coin",
141
"textCoins:array.coin",
142
"--module",
143
"foo",
144
)
145
146
app.Scaffold(
147
"create a custom field type",
148
false,
149
"type", "custom-type", "customField:uint", "textCoinsAlias:coins", "--module", "foo",
150
)
151
152
app.Scaffold(
153
"create a packet with a custom field type",
154
false, "packet", "foo-baz", "customField:CustomType", "--module", "foo",
155
)
156
157
app.Scaffold(
158
"create a packet with no send message",
159
false, "packet", "nomessage", "foo", "--no-message", "--module", "foo",
160
)
161
162
app.Scaffold(
163
"create a packet with no field",
164
false, "packet", "empty", "--module", "foo",
165
)
166
167
app.Scaffold(
168
"create a non-IBC module",
169
false, "module", "bar", "--require-registration",
170
)
171
172
app.Scaffold(
173
"should prevent creating a packet in a non IBC module",
174
true, "packet", "foo", "text", "--module", "bar",
175
)
176
177
app.EnsureSteady()
178
}
179
180