Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ignite
GitHub Repository: ignite/cli
Path: blob/main/integration/list/cmd_list_test.go
1007 views
1
//go:build !relayer
2
3
package list_test
4
5
import (
6
"testing"
7
8
envtest "github.com/ignite/cli/v29/integration"
9
)
10
11
func TestGenerateAnAppWithListAndVerify(t *testing.T) {
12
var (
13
env = envtest.New(t)
14
app = env.ScaffoldApp("github.com/test/blog")
15
servers = app.RandomizeServerPorts()
16
)
17
18
app.Scaffold(
19
"create a module",
20
false,
21
"module", "example", "--require-registration",
22
)
23
24
app.Scaffold(
25
"create a list",
26
false,
27
"list", "user", "email",
28
)
29
30
app.Scaffold(
31
"create a list with custom path and module",
32
false,
33
"list",
34
"AppPath",
35
"email",
36
"--path",
37
"blog",
38
"--module",
39
"example",
40
)
41
42
app.Scaffold(
43
"create a custom type fields",
44
false,
45
"list",
46
"employee",
47
"numInt:int",
48
"numsInt:array.int",
49
"numsIntAlias:ints",
50
"numUint:uint",
51
"numsUint:array.uint",
52
"numsUintAlias:uints",
53
"textString:string",
54
"textStrings:array.string",
55
"textStringsAlias:strings",
56
"textCoin:coin",
57
"textCoins:array.coin",
58
"--no-simulation",
59
)
60
61
app.Scaffold(
62
"create a list with bool",
63
false,
64
"list",
65
"document",
66
"signed:bool",
67
"textCoinsAlias:coins",
68
"--module",
69
"example",
70
)
71
72
app.Scaffold(
73
"create a list with decimal coin",
74
false,
75
"list",
76
"decimal",
77
"deccointype:dec.coin",
78
"deccoins:dec.coins",
79
"--module",
80
"example",
81
)
82
83
app.Scaffold(
84
"create a list with custom field type",
85
false,
86
"list",
87
"custom",
88
"document:Document",
89
"--module",
90
"example",
91
)
92
93
app.Scaffold(
94
"should prevent creating a list with duplicated fields",
95
true,
96
"list", "company", "name", "name",
97
)
98
99
app.Scaffold(
100
"should prevent creating a list with unrecognized field type",
101
true,
102
"list", "invalidField", "level:itn",
103
)
104
105
app.Scaffold(
106
"should prevent creating an existing list",
107
true,
108
"list", "user", "email",
109
)
110
111
app.Scaffold(
112
"should prevent creating a list whose name is a reserved word",
113
true,
114
"list", "map", "size:int",
115
)
116
117
app.Scaffold(
118
"should prevent creating a list containing a field with a reserved word",
119
true,
120
"list", "document", "type:int",
121
)
122
123
app.Scaffold(
124
"create a list with no interaction message",
125
false,
126
"list", "nomessage", "email", "--no-message",
127
)
128
129
app.Scaffold(
130
"should prevent creating a list in a non existent module",
131
true,
132
"list", "user", "email", "--module", "idontexist",
133
)
134
135
app.EnsureSteady()
136
137
app.RunChainAndSimulateTxs(servers)
138
}
139
140