@@ -32,7 +32,7 @@ func TestRun(t *testing.T) {
32
32
fsys := afero .NewMemMapFs ()
33
33
34
34
// Create project config file with project reference
35
- projectRef := "test-project-ref "
35
+ projectRef := "abcdefghijklmnopqrst "
36
36
require .NoError (t , utils .InitConfig (utils.InitParams {
37
37
ProjectId : projectRef ,
38
38
}, fsys ))
@@ -72,7 +72,7 @@ func TestCheckVersions(t *testing.T) {
72
72
fsys := afero .NewMemMapFs ()
73
73
74
74
// Create project config file with project reference
75
- projectRef := "test-project-ref "
75
+ projectRef := "abcdefghijklmnopqrst "
76
76
require .NoError (t , utils .InitConfig (utils.InitParams {
77
77
ProjectId : projectRef ,
78
78
}, fsys ))
@@ -98,7 +98,7 @@ func TestCheckVersions(t *testing.T) {
98
98
fsys := afero .NewMemMapFs ()
99
99
100
100
// Create project config file with project reference
101
- projectRef := "test-project-ref "
101
+ projectRef := "abcdefghijklmnopqrst "
102
102
require .NoError (t , utils .InitConfig (utils.InitParams {
103
103
ProjectId : projectRef ,
104
104
}, fsys ))
@@ -121,7 +121,7 @@ func TestCheckVersions(t *testing.T) {
121
121
// Test case: Verify version comparison logic
122
122
t .Run ("compares local and remote versions correctly" , func (t * testing.T ) {
123
123
fsys := afero .NewMemMapFs ()
124
- projectRef := "test-project-ref "
124
+ projectRef := "abcdefghijklmnopqrst "
125
125
126
126
// Setup: Create linked project with specific versions
127
127
require .NoError (t , utils .InitConfig (utils.InitParams {
@@ -162,7 +162,7 @@ func TestListRemoteImages(t *testing.T) {
162
162
t .Run ("gets remote versions successfully" , func (t * testing.T ) {
163
163
// Setup: Create context and project reference
164
164
ctx := context .Background ()
165
- projectRef := "test-project-ref "
165
+ projectRef := "abcdefghijklmnopqrst "
166
166
167
167
// Setup: Create in-memory filesystem
168
168
fsys := afero .NewMemMapFs ()
@@ -182,23 +182,33 @@ func TestListRemoteImages(t *testing.T) {
182
182
{"name" : "anon" , "api_key" : "test-key" },
183
183
})
184
184
185
- // Mock database version response
186
185
gock .New (utils .DefaultApiHost ).
187
- Get ("/v1/projects/" + projectRef + "/database/version " ).
186
+ Get ("/v1/projects" ).
188
187
Reply (200 ).
189
- JSON (map [string ]string {"version" : "1.0.0" })
188
+ JSON ([]map [string ]interface {}{
189
+ {
190
+ "id" : projectRef ,
191
+ "database" : map [string ]string {
192
+ "version" : "1.0.0" ,
193
+ },
194
+ },
195
+ })
190
196
191
- // Mock auth version response
192
- gock .New (utils .DefaultApiHost ).
193
- Get ("/auth/v1/version" ).
197
+ gock .New ("https://" + utils .GetSupabaseHost (projectRef )).
198
+ Get ("/auth/v1/health" ).
194
199
Reply (200 ).
195
200
JSON (map [string ]string {"version" : "2.0.0" })
196
201
197
- // Mock postgrest version response
198
- gock .New (utils .DefaultApiHost ).
199
- Get ("/rest/v1/version " ).
202
+ // Mock postgrest version response (endpoint = /rest/v1/ sur le host du projet)
203
+ gock .New ("https://" + utils .GetSupabaseHost ( projectRef ) ).
204
+ Get ("/rest/v1/" ).
200
205
Reply (200 ).
201
- JSON (map [string ]string {"version" : "3.0.0" })
206
+ JSON (map [string ]interface {}{
207
+ "swagger" : "2.0" ,
208
+ "info" : map [string ]string {
209
+ "version" : "3.0.0" ,
210
+ },
211
+ })
202
212
203
213
// Execute: Call listRemoteImages function
204
214
remoteVersions := listRemoteImages (ctx , projectRef )
@@ -243,7 +253,7 @@ func TestListRemoteImages(t *testing.T) {
243
253
t .Run ("handles missing access token" , func (t * testing.T ) {
244
254
// Setup: Create context and project reference
245
255
ctx := context .Background ()
246
- projectRef := "test-project-ref "
256
+ projectRef := "abcdefghijklmnopqrst "
247
257
248
258
// Setup: Create in-memory filesystem without access token
249
259
afero .NewMemMapFs ()
0 commit comments