Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ignite
GitHub Repository: ignite/cli
Path: blob/main/integration/other_components/cmd_query_test.go
1007 views
1
//go:build !relayer
2
3
package other_components_test
4
5
import (
6
"testing"
7
8
envtest "github.com/ignite/cli/v29/integration"
9
)
10
11
func TestGenerateAnAppWithQuery(t *testing.T) {
12
var (
13
env = envtest.New(t)
14
app = env.ScaffoldApp("github.com/test/blog")
15
)
16
17
app.Scaffold(
18
"create a query",
19
false,
20
"query",
21
"foo",
22
"text",
23
"vote:int",
24
"like:bool",
25
"-r",
26
"foo,bar:int,foobar:bool",
27
)
28
29
app.Scaffold(
30
"create a query with custom path",
31
false,
32
"query",
33
"AppPath",
34
"text",
35
"vote:int",
36
"like:bool",
37
"-r",
38
"foo,bar:int,foobar:bool",
39
"--path",
40
"./blog",
41
)
42
43
app.Scaffold(
44
"create a paginated query",
45
false,
46
"query",
47
"bar",
48
"text",
49
"vote:int",
50
"like:bool",
51
"-r",
52
"foo,bar:int,foobar:bool",
53
"--paginated",
54
)
55
56
app.Scaffold(
57
"create a custom field type",
58
false,
59
"type",
60
"custom-type",
61
"numInt:int",
62
"numsInt:array.int",
63
"numsIntAlias:ints",
64
"numUint:uint",
65
"numsUint:array.uint",
66
"numsUintAlias:uints",
67
"textString:string",
68
"textStrings:array.string",
69
"textStringsAlias:strings",
70
"textCoin:coin",
71
"textCoins:array.coin",
72
)
73
74
app.Scaffold(
75
"create a query with the custom field type as a response",
76
false,
77
"query", "foobaz", "-r", "bar:CustomType",
78
)
79
80
app.Scaffold(
81
"should prevent using custom type in request params",
82
true,
83
"query", "bur", "bar:CustomType",
84
)
85
86
app.Scaffold(
87
"create an empty query",
88
false,
89
"query", "foobar",
90
)
91
92
app.Scaffold(
93
"should prevent creating an existing query",
94
true,
95
"query", "foo", "bar",
96
)
97
98
app.Scaffold(
99
"create a module",
100
false,
101
"module", "foo", "--require-registration",
102
)
103
104
app.Scaffold(
105
"create a query in a module",
106
false,
107
"query",
108
"foo",
109
"text",
110
"--module",
111
"foo",
112
"--desc",
113
"foo bar foobar",
114
"--response",
115
"foo,bar:int,foobar:bool",
116
)
117
118
app.EnsureSteady()
119
}
120
121