@@ -8,8 +8,19 @@ import { LegacyLinkedProjectCache } from "../../telemetry/legacy-linked-project-
88import { LegacyOutputFlag } from "../../../shared/legacy/global-flags.ts" ;
99import { mockOutput } from "../../../../tests/helpers/mocks.ts" ;
1010import { mockLegacyTelemetryStateTracked } from "../../../../tests/helpers/legacy-mocks.ts" ;
11+ import { listLocalServiceVersions } from "../../../shared/services/services.shared.ts" ;
1112import { legacyServices } from "./services.handler.ts" ;
1213
14+ const LOCAL_POSTGRES_SERVICE = listLocalServiceVersions ( ) . find (
15+ ( service ) => service . name === "supabase/postgres" ,
16+ ) ;
17+
18+ if ( LOCAL_POSTGRES_SERVICE === undefined ) {
19+ throw new Error ( "Missing supabase/postgres in local service versions." ) ;
20+ }
21+
22+ const LOCAL_POSTGRES_VERSION = LOCAL_POSTGRES_SERVICE . local ;
23+
1324function setup (
1425 opts : {
1526 format ?: "text" | "json" | "stream-json" ;
@@ -106,7 +117,10 @@ describe("legacy services", () => {
106117 remote : string ;
107118 } > ;
108119 expect ( rows ) . toHaveLength ( 10 ) ;
109- expect ( rows [ 0 ] ) . toMatchObject ( { name : "supabase/postgres" , local : "17.6.1.132" } ) ;
120+ expect ( rows [ 0 ] ) . toMatchObject ( {
121+ name : "supabase/postgres" ,
122+ local : LOCAL_POSTGRES_VERSION ,
123+ } ) ;
110124 } ) ;
111125 } ) ;
112126
@@ -121,7 +135,10 @@ describe("legacy services", () => {
121135 const success = out . messages . find ( ( message ) => message . type === "success" ) ;
122136 expect ( success ?. data ) . toMatchObject ( {
123137 services : expect . arrayContaining ( [
124- expect . objectContaining ( { name : "supabase/postgres" , local : "17.6.1.132" } ) ,
138+ expect . objectContaining ( {
139+ name : "supabase/postgres" ,
140+ local : LOCAL_POSTGRES_VERSION ,
141+ } ) ,
125142 ] ) ,
126143 } ) ;
127144 } ) ;
@@ -136,7 +153,10 @@ describe("legacy services", () => {
136153 const success = out . messages . find ( ( message ) => message . type === "success" ) ;
137154 expect ( success ?. data ) . toMatchObject ( {
138155 services : expect . arrayContaining ( [
139- expect . objectContaining ( { name : "supabase/postgres" , local : "17.6.1.132" } ) ,
156+ expect . objectContaining ( {
157+ name : "supabase/postgres" ,
158+ local : LOCAL_POSTGRES_VERSION ,
159+ } ) ,
140160 ] ) ,
141161 } ) ;
142162 } ) ;
@@ -160,7 +180,7 @@ describe("legacy services", () => {
160180 yield * legacyServices ( { } ) . pipe ( Effect . provide ( layer ) ) ;
161181
162182 expect ( out . stdoutText ) . toContain ( "- name: supabase/postgres" ) ;
163- expect ( out . stdoutText ) . toContain ( " local: 17.6.1.132" ) ;
183+ expect ( out . stdoutText ) . toContain ( ` local: ${ LOCAL_POSTGRES_VERSION } ` ) ;
164184 } ) ;
165185 } ) ;
166186
0 commit comments