@@ -100,6 +100,17 @@ func ReGenerateProject(kbc *utils.TestContext) {
100
100
)
101
101
ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
102
102
103
+ By ("create APIs with resource and controller" )
104
+ err = kbc .CreateAPI (
105
+ "--group" , "crew" ,
106
+ "--version" , "v1" ,
107
+ "--kind" , "Captain" ,
108
+ "--namespaced" ,
109
+ "--resource" ,
110
+ "--controller" ,
111
+ )
112
+ ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
113
+
103
114
By ("regenerating the project at another output directory" )
104
115
err = kbc .Regenerate (
105
116
"--input-dir" , kbc .Dir ,
@@ -113,4 +124,39 @@ func ReGenerateProject(kbc *utils.TestContext) {
113
124
filepath .Join (kbc .Dir , "testdir2" , "PROJECT" ), multiGroup )
114
125
ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
115
126
ExpectWithOffset (1 , fileContainsExpr ).To (BeTrue ())
127
+
128
+ By ("checking if the project file was generated with the expected group" )
129
+ var APIGroup = "group: crew"
130
+ fileContainsExpr , err = pluginutil .HasFileContentWith (
131
+ filepath .Join (kbc .Dir , "testdir2" , "PROJECT" ), APIGroup )
132
+ ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
133
+ ExpectWithOffset (1 , fileContainsExpr ).To (BeTrue ())
134
+
135
+ By ("checking if the project file was generated with the expected kind" )
136
+ var APIKind = "kind: Captain"
137
+ fileContainsExpr , err = pluginutil .HasFileContentWith (
138
+ filepath .Join (kbc .Dir , "testdir2" , "PROJECT" ), APIKind )
139
+ ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
140
+ ExpectWithOffset (1 , fileContainsExpr ).To (BeTrue ())
141
+
142
+ By ("checking if the project file was generated with the expected version" )
143
+ var APIVersion = "version: v1"
144
+ fileContainsExpr , err = pluginutil .HasFileContentWith (
145
+ filepath .Join (kbc .Dir , "testdir2" , "PROJECT" ), APIVersion )
146
+ ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
147
+ ExpectWithOffset (1 , fileContainsExpr ).To (BeTrue ())
148
+
149
+ By ("checking if the project file was generated with the expected namespaced" )
150
+ var namespaced = "namespaced: true"
151
+ fileContainsExpr , err = pluginutil .HasFileContentWith (
152
+ filepath .Join (kbc .Dir , "testdir2" , "PROJECT" ), namespaced )
153
+ ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
154
+ ExpectWithOffset (1 , fileContainsExpr ).To (BeTrue ())
155
+
156
+ By ("checking if the project file was generated with the expected controller" )
157
+ var controller = "controller: true"
158
+ fileContainsExpr , err = pluginutil .HasFileContentWith (
159
+ filepath .Join (kbc .Dir , "testdir2" , "PROJECT" ), controller )
160
+ ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
161
+ ExpectWithOffset (1 , fileContainsExpr ).To (BeTrue ())
116
162
}
0 commit comments