@@ -196,8 +196,7 @@ describe("postgres driver codegen", () => {
196196 expect ( output ) . toContain ( 'import type { Sql as SQL } from "postgres"' ) ;
197197 } ) ;
198198
199- it ( "produces same function signatures as bun-sql driver" , ( ) => {
200- const bunDriver = new BunSqlDriver ( ) ;
199+ it ( "generates simpler code that casts directly to Row type" , ( ) => {
201200 const postgresDriver = new PostgresDriver ( ) ;
202201
203202 const params : Parameter [ ] = [
@@ -209,10 +208,7 @@ describe("postgres driver codegen", () => {
209208 { name : "name" , type : { name : "text" } , notNull : true } as unknown as Column ,
210209 ] ;
211210
212- const bunOutput = print (
213- bunDriver . oneDecl ( "getThing" , "getThingQuery" , "GetThingArgs" , "GetThingRow" , params , columns ) ,
214- ) ;
215- const postgresOutput = print (
211+ const output = print (
216212 postgresDriver . oneDecl (
217213 "getThing" ,
218214 "getThingQuery" ,
@@ -223,7 +219,9 @@ describe("postgres driver codegen", () => {
223219 ) ,
224220 ) ;
225221
226- // The function bodies should be identical (both use SQL as the type name)
227- expect ( bunOutput ) . toBe ( postgresOutput ) ;
222+ // postgres.js driver casts directly to Row[] without .values()
223+ expect ( output ) . toContain ( "as GetThingRow[]" ) ;
224+ expect ( output ) . not . toContain ( ".values()" ) ;
225+ expect ( output ) . toContain ( "rows[0] ?? null" ) ;
228226 } ) ;
229227} ) ;
0 commit comments