@@ -79,6 +79,7 @@ test.serial(`${currentTest} should create a hosted postgres connection with admi
7979 . send ( {
8080 companyId : companyId ,
8181 userId : userId ,
82+ hostedDatabaseId : faker . string . uuid ( ) ,
8283 databaseName : 'postgres' ,
8384 hostname : 'testPg-e2e-testing' ,
8485 port : 5432 ,
@@ -89,24 +90,14 @@ test.serial(`${currentTest} should create a hosted postgres connection with admi
8990 . set ( 'Content-Type' , 'application/json' )
9091 . set ( 'Accept' , 'application/json' ) ;
9192
92- t . is ( createHostedConnectionResult . status , 201 ) ;
93-
9493 const createdConnection = JSON . parse ( createHostedConnectionResult . text ) ;
95- const connectionId = createdConnection . id ;
94+ console . log ( '🚀 ~ createdConnection:' , createdConnection ) ;
95+
96+ t . is ( createHostedConnectionResult . status , 201 ) ;
97+ const connectionId = createdConnection . connectionId ;
9698
9799 // Verify connection was created
98100 t . truthy ( connectionId ) ;
99- t . is ( createdConnection . type , 'postgres' ) ;
100- t . is ( createdConnection . database , 'postgres' ) ;
101- t . is ( createdConnection . host , 'testPg-e2e-testing' ) ;
102- t . is ( createdConnection . port , 5432 ) ;
103-
104- // Verify admin group was created
105- t . truthy ( createdConnection . groups ) ;
106- t . is ( createdConnection . groups . length , 1 ) ;
107- const adminGroup = createdConnection . groups [ 0 ] ;
108- t . truthy ( adminGroup . id ) ;
109- t . is ( adminGroup . isMain , true ) ;
110101
111102 // Verify connection is accessible via connection groups endpoint
112103 const groupsResponse = await request ( app . getHttpServer ( ) )
@@ -119,6 +110,7 @@ test.serial(`${currentTest} should create a hosted postgres connection with admi
119110 const groups = JSON . parse ( groupsResponse . text ) ;
120111 t . is ( groups . length , 1 ) ;
121112 t . is ( groups [ 0 ] . accessLevel , AccessLevelEnum . edit ) ;
113+ const adminGroup = groups [ 0 ] ;
122114
123115 // Verify tables endpoint works with this connection
124116 const findTablesResponse = await request ( app . getHttpServer ( ) )
@@ -132,8 +124,9 @@ test.serial(`${currentTest} should create a hosted postgres connection with admi
132124 t . true ( Array . isArray ( tables ) ) ;
133125
134126 // Verify user permissions - user should have full access
127+ const groupId = adminGroup . group . id ;
135128 const permissionsResponse = await request ( app . getHttpServer ( ) )
136- . get ( `/connection/permissions?connectionId=${ connectionId } &groupId=${ adminGroup . id } ` )
129+ . get ( `/connection/permissions?connectionId=${ connectionId } &groupId=${ groupId } ` )
137130 . set ( 'Content-Type' , 'application/json' )
138131 . set ( 'Cookie' , token )
139132 . set ( 'Accept' , 'application/json' ) ;
@@ -177,6 +170,7 @@ test.serial(`${currentTest} should return error when userId does not exist`, asy
177170 . send ( {
178171 companyId : faker . string . uuid ( ) ,
179172 userId : faker . string . uuid ( ) ,
173+ hostedDatabaseId : faker . string . uuid ( ) ,
180174 databaseName : 'postgres' ,
181175 hostname : 'testPg-e2e-testing' ,
182176 port : 5432 ,
@@ -187,6 +181,8 @@ test.serial(`${currentTest} should return error when userId does not exist`, asy
187181 . set ( 'Content-Type' , 'application/json' )
188182 . set ( 'Accept' , 'application/json' ) ;
189183
184+ const responseBody = JSON . parse ( result . text ) ;
185+ console . log ( '🚀 ~ responseBody:' , responseBody ) ;
190186 t . is ( result . status , 500 ) ;
191187 } catch ( e ) {
192188 console . error ( 'Test error:' , e ) ;
@@ -219,6 +215,7 @@ test.serial(`${currentTest} should delete a hosted connection`, async (t) => {
219215 . send ( {
220216 companyId : companyId ,
221217 userId : userId ,
218+ hostedDatabaseId : faker . string . uuid ( ) ,
222219 databaseName : 'postgres' ,
223220 hostname : 'testPg-e2e-testing' ,
224221 port : 5432 ,
@@ -229,9 +226,10 @@ test.serial(`${currentTest} should delete a hosted connection`, async (t) => {
229226 . set ( 'Content-Type' , 'application/json' )
230227 . set ( 'Accept' , 'application/json' ) ;
231228
232- t . is ( createResult . status , 201 ) ;
233229 const createdConnection = JSON . parse ( createResult . text ) ;
234- const connectionId = createdConnection . id ;
230+ console . log ( '🚀 ~ createdConnection:' , createdConnection ) ;
231+ t . is ( createResult . status , 201 ) ;
232+ const connectionId = createdConnection . connectionId ;
235233
236234 // Verify connection exists
237235 const connectionsBeforeDelete = await request ( app . getHttpServer ( ) )
0 commit comments