@@ -2,29 +2,26 @@ import { expect, test, assertType } from 'vitest';
22import { server } from '@vitest/browser/context' ;
33import { neon , Pool , Client , type QueryResult } from '../../dist/npm' ;
44
5- const { env } = server . config ;
6- globalThis . process = { env } as any ;
7-
8- const DB_URL = process . env . VITE_NEON_DB_URL ! ;
5+ const DATABASE_URL = server . config . env . VITE_NEON_DB_URL ! ;
96
107test ( 'http query' , async ( ) => {
11- const sql = neon ( DB_URL ) ;
8+ const sql = neon ( DATABASE_URL ) ;
129 const str = 'fetch' ;
1310 const fetchResult = await sql `SELECT ${ str } AS str` ;
1411 assertType < Record < string , unknown > [ ] > ( fetchResult ) ;
1512 expect ( fetchResult ) . toStrictEqual ( [ { str : 'fetch' } ] ) ;
1613} ) ;
1714
1815test ( 'pool.query() over WebSockets' , async ( ) => {
19- const wsPool = new Pool ( { connectionString : DB_URL } ) ;
16+ const wsPool = new Pool ( { connectionString : DATABASE_URL } ) ;
2017 const wsResult = await wsPool . query ( 'SELECT $1::int AS one' , [ 1 ] ) ;
2118 assertType < QueryResult < any > > ( wsResult ) ;
2219 expect ( wsResult . rows ) . toStrictEqual ( [ { one : 1 } ] ) ;
2320 expect ( ( wsResult as any ) . viaNeonFetch ) . toBeUndefined ( ) ;
2421} ) ;
2522
2623test ( 'client.query()' , async ( ) => {
27- const client = new Client ( DB_URL ) ;
24+ const client = new Client ( DATABASE_URL ) ;
2825 await client . connect ( ) ;
2926 const wsResult = await client . query ( 'SELECT $1::int AS one' , [ 1 ] ) ;
3027 assertType < QueryResult < any > > ( wsResult ) ;
0 commit comments