Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ignite
GitHub Repository: ignite/cli
Path: blob/main/integration/map/cmd_map_test.go
1007 views
1
//go:build !relayer
2
3
package map_test
4
5
import (
6
"path/filepath"
7
"testing"
8
9
envtest "github.com/ignite/cli/v29/integration"
10
)
11
12
func TestCreateMap(t *testing.T) {
13
var (
14
env = envtest.New(t)
15
app = env.ScaffoldApp("github.com/test/blog")
16
servers = app.RandomizeServerPorts()
17
)
18
19
app.Scaffold(
20
"create a map",
21
false,
22
"map", "user", "user-id", "email",
23
)
24
25
app.Scaffold(
26
"create a map with custom path",
27
false,
28
"map", "appPath", "email", "--path", filepath.Join(app.SourcePath(), "app"),
29
)
30
31
app.Scaffold(
32
"create a map with no message",
33
false,
34
"map", "nomessage", "email", "--no-message",
35
)
36
37
app.Scaffold(
38
"create a module",
39
false,
40
"module", "example", "--require-registration",
41
)
42
43
app.Scaffold(
44
"create a list",
45
false,
46
"list",
47
"user",
48
"email",
49
"--module",
50
"example",
51
"--no-simulation",
52
)
53
54
app.Scaffold(
55
"create a map with decimal coin",
56
false,
57
"map",
58
"decimal",
59
"deccointype:dec.coin",
60
"deccoins:dec.coins",
61
"--module",
62
"example",
63
)
64
65
app.Scaffold(
66
"should prevent creating a map with a typename that already exist",
67
true,
68
"map", "user", "email", "--module", "example",
69
)
70
71
app.Scaffold(
72
"create a map in a custom module",
73
false,
74
"map", "mapUser", "email", "--module", "example",
75
)
76
77
app.Scaffold(
78
"create a map with a custom field type",
79
false,
80
"map", "mapDetail", "user:MapUser", "--module", "example",
81
)
82
83
app.Scaffold(
84
"create a map with Coin and []Coin",
85
false,
86
"map",
87
"salary",
88
"numInt:int",
89
"numsInt:array.int",
90
"numsIntAlias:ints",
91
"numUint:uint",
92
"numsUint:array.uint",
93
"numsUintAlias:uints",
94
"textString:string",
95
"textStrings:array.string",
96
"textStringsAlias:strings",
97
"textCoin:coin",
98
"textCoinsAlias:coins",
99
"--module",
100
"example",
101
)
102
103
app.Scaffold(
104
"create a map with Coin and Coins",
105
false,
106
"map",
107
"budget",
108
"textCoin:coin",
109
"textCoins:array.coin",
110
"--module",
111
"example",
112
)
113
114
app.Scaffold(
115
"create a map with index",
116
false,
117
"map",
118
"map_with_index",
119
"email",
120
"emailIds:ints",
121
"--index",
122
"bar:int",
123
"--module",
124
"example",
125
)
126
127
app.Scaffold(
128
"create a map with invalid index (multi-index)",
129
true,
130
"map",
131
"map_with_invalid_index",
132
"email",
133
"--index",
134
"foo:strings,bar:int",
135
"--module",
136
"example",
137
)
138
139
app.Scaffold(
140
"create a map with invalid index (invalid type)",
141
true,
142
"map",
143
"map_with_invalid_index",
144
"email",
145
"--index",
146
"foo:unknown",
147
"--module",
148
"example",
149
)
150
151
app.Scaffold(
152
"create a message and a map with no-message flag to check conflicts",
153
false,
154
"message", "create-scavenge", "description",
155
)
156
157
app.Scaffold(
158
"create a message and a map with no-message flag to check conflicts",
159
false,
160
"map", "scavenge", "description", "--no-message",
161
)
162
163
app.Scaffold(
164
"should prevent creating a map with an index present in fields",
165
true,
166
"map", "map_with_invalid_index", "email", "--index", "email",
167
)
168
169
app.EnsureSteady()
170
171
app.RunChainAndSimulateTxs(servers)
172
}
173
174