@@ -19,8 +19,9 @@ func TestCreateApp(t *testing.T) {
1919 httpClient := GetHttpclient (t )
2020
2121 defaultRequestBody := client.CreateAppRequest {
22- Icon : f .Ptr ("🌎" ),
23- Name : "HelloWorld" ,
22+ Icon : f .Ptr ("🌎" ),
23+ Name : "HelloWorld" ,
24+ Description : f .Ptr ("My HelloWorld description" ),
2425 }
2526
2627 testCases := []struct {
@@ -56,8 +57,9 @@ func TestCreateApp(t *testing.T) {
5657 SkipSketch : f .Ptr (false ),
5758 },
5859 body : client.CreateAppRequest {
59- Icon : f .Ptr ("🌎" ),
60- Name : "HelloWorld_2" ,
60+ Icon : f .Ptr ("🌎" ),
61+ Name : "HelloWorld_2" ,
62+ Description : f .Ptr ("My HelloWorld_2 description" ),
6163 },
6264 expectedStatusCode : http .StatusCreated ,
6365 },
@@ -68,8 +70,9 @@ func TestCreateApp(t *testing.T) {
6870 SkipSketch : f .Ptr (true ),
6971 },
7072 body : client.CreateAppRequest {
71- Icon : f .Ptr ("🌎" ),
72- Name : "HelloWorld_3" ,
73+ Icon : f .Ptr ("🌎" ),
74+ Name : "HelloWorld_3" ,
75+ Description : f .Ptr ("My HelloWorld_3 description" ),
7376 },
7477 expectedStatusCode : http .StatusCreated ,
7578 },
@@ -107,6 +110,47 @@ func TestCreateApp(t *testing.T) {
107110 }
108111}
109112
113+ func TestCreateAndVerifyAppDetails (t * testing.T ) {
114+ httpClient := GetHttpclient (t )
115+ appToCreate := client.CreateAppRequest {
116+ Icon : f .Ptr ("🧪" ),
117+ Name : "test-app-for-verification" ,
118+ Description : f .Ptr ("A description for the verification test." ),
119+ }
120+
121+ createResp , err := httpClient .CreateAppWithResponse (
122+ t .Context (),
123+ & client.CreateAppParams {SkipSketch : f .Ptr (true )},
124+ appToCreate ,
125+ )
126+
127+ require .NoError (t , err )
128+ require .Equal (t , http .StatusCreated , createResp .StatusCode ())
129+ require .NotNil (t , createResp .JSON201 , "The creation response body should not be nil" )
130+ require .NotNil (t , createResp .JSON201 .Id , "The created app ID should not be nil" )
131+
132+ createdAppId := * createResp .JSON201 .Id
133+
134+ detailsResp , err := httpClient .GetAppDetailsWithResponse (t .Context (), createdAppId )
135+
136+ require .NoError (t , err )
137+ require .Equal (t , http .StatusOK , detailsResp .StatusCode ())
138+ require .NotNil (t , detailsResp .JSON200 , "The get details response body should not be nil" )
139+
140+ retrievedApp := detailsResp .JSON200
141+
142+ require .Equal (t , createdAppId , retrievedApp .Id )
143+ require .Equal (t , appToCreate .Name , retrievedApp .Name )
144+ require .Equal (t , * appToCreate .Icon , * retrievedApp .Icon )
145+ require .Equal (t , * appToCreate .Description , * retrievedApp .Description )
146+
147+ require .False (t , * retrievedApp .Example , "A new app should not be an 'example'" )
148+ require .False (t , * retrievedApp .Default , "A new app should not be 'default'" )
149+ require .Equal (t , client .Stopped , retrievedApp .Status , "The initial status of a new app should be 'stopped'" )
150+ require .Empty (t , retrievedApp .Bricks , "A new app should not have 'bricks'" )
151+ require .NotEmpty (t , retrievedApp .Path , "The app path should not be empty" )
152+ }
153+
110154func TestEditApp (t * testing.T ) {
111155 httpClient := GetHttpclient (t )
112156
@@ -115,8 +159,9 @@ func TestEditApp(t *testing.T) {
115159 t .Context (),
116160 & client.CreateAppParams {SkipSketch : f .Ptr (true )},
117161 client.CreateAppRequest {
118- Icon : f .Ptr ("💻" ),
119- Name : appName ,
162+ Icon : f .Ptr ("💻" ),
163+ Name : appName ,
164+ Description : f .Ptr ("My app description" ),
120165 },
121166 )
122167 require .NoError (t , err )
@@ -192,8 +237,9 @@ func TestEditApp(t *testing.T) {
192237 t .Context (),
193238 & client.CreateAppParams {SkipSketch : f .Ptr (true )},
194239 client.CreateAppRequest {
195- Icon : f .Ptr ("💻" ),
196- Name : "new-valid-app" ,
240+ Icon : f .Ptr ("💻" ),
241+ Name : "new-valid-app" ,
242+ Description : f .Ptr ("My app description" ),
197243 },
198244 )
199245 require .NoError (t , err )
@@ -230,8 +276,9 @@ func TestDeleteApp(t *testing.T) {
230276 t .Context (),
231277 & client.CreateAppParams {SkipSketch : f .Ptr (true )},
232278 client.CreateAppRequest {
233- Icon : f .Ptr ("🗑️" ),
234- Name : appToDeleteName ,
279+ Icon : f .Ptr ("🗑️" ),
280+ Name : appToDeleteName ,
281+ Description : f .Ptr ("My app description" ),
235282 },
236283 )
237284 require .NoError (t , err )
@@ -375,8 +422,9 @@ func TestAppClone(t *testing.T) {
375422 t .Context (),
376423 & client.CreateAppParams {},
377424 client.CreateAppRequest {
378- Icon : f .Ptr ("📄" ),
379- Name : "source-app" ,
425+ Icon : f .Ptr ("📄" ),
426+ Name : "source-app" ,
427+ Description : f .Ptr ("My app description" ),
380428 },
381429 )
382430 require .NoError (t , err )
@@ -387,8 +435,9 @@ func TestAppClone(t *testing.T) {
387435 t .Context (),
388436 & client.CreateAppParams {},
389437 client.CreateAppRequest {
390- Icon : f .Ptr ("🚫" ),
391- Name : "existing-clone-name" ,
438+ Icon : f .Ptr ("🚫" ),
439+ Name : "existing-clone-name" ,
440+ Description : f .Ptr ("My app description" ),
392441 },
393442 )
394443 require .NoError (t , err )
@@ -492,8 +541,9 @@ func TestAppLogs(t *testing.T) {
492541 t .Context (),
493542 & client.CreateAppParams {},
494543 client.CreateAppRequest {
495- Icon : f .Ptr ("📜" ),
496- Name : "app-with-logs" ,
544+ Icon : f .Ptr ("📜" ),
545+ Name : "app-with-logs" ,
546+ Description : f .Ptr ("My app description" ),
497547 },
498548 )
499549 require .NoError (t , err )
@@ -556,8 +606,9 @@ func TestAppDetails(t *testing.T) {
556606 t .Context (),
557607 & client.CreateAppParams {SkipSketch : f .Ptr (true )},
558608 client.CreateAppRequest {
559- Icon : f .Ptr ("💻" ),
560- Name : appName ,
609+ Icon : f .Ptr ("💻" ),
610+ Name : appName ,
611+ Description : f .Ptr ("My app description" ),
561612 },
562613 )
563614 require .NoError (t , err )
@@ -582,6 +633,7 @@ func TestAppDetails(t *testing.T) {
582633 require .Equal (t , * appID , detailsResp .JSON200 .Id )
583634 require .Equal (t , appName , detailsResp .JSON200 .Name )
584635 require .Equal (t , "💻" , * detailsResp .JSON200 .Icon )
636+ require .Equal (t , "My app description" , * detailsResp .JSON200 .Description )
585637 require .Len (t , * detailsResp .JSON200 .Bricks , 1 )
586638 require .Equal (t ,
587639 client.AppDetailedBrick {
@@ -607,8 +659,9 @@ func TestAppPorts(t *testing.T) {
607659 t .Context (),
608660 & client.CreateAppParams {SkipSketch : f .Ptr (true )},
609661 client.CreateAppRequest {
610- Icon : f .Ptr ("💻" ),
611- Name : "test-app" ,
662+ Icon : f .Ptr ("💻" ),
663+ Name : "test-app" ,
664+ Description : f .Ptr ("My app description" ),
612665 },
613666 func (ctx context.Context , req * http.Request ) error { return nil },
614667 )
@@ -652,8 +705,9 @@ func TestAppPorts(t *testing.T) {
652705 t .Context (),
653706 & client.CreateAppParams {SkipSketch : f .Ptr (true )},
654707 client.CreateAppRequest {
655- Icon : f .Ptr ("💻" ),
656- Name : "test-app-2" ,
708+ Icon : f .Ptr ("💻" ),
709+ Name : "test-app-2" ,
710+ Description : f .Ptr ("My app description" ),
657711 },
658712 func (ctx context.Context , req * http.Request ) error { return nil },
659713 )
0 commit comments