1- var helper = require ( __dirname + ' /test-helper') ;
1+ var helper = require ( '. /test-helper') ;
22var util = require ( 'util' ) ;
33
4+ const { pg } = helper
45
5- test ( 'non-query error with callback' , function ( ) {
6- var client = new Client ( {
7- user :'asldkfjsadlfkj'
8- } ) ;
9- client . connect ( assert . calls ( function ( err ) {
10- assert ( err ) ;
11- } ) ) ;
12- } ) ;
13-
14- test ( 'non-query error' , function ( ) {
15- var client = new Client ( {
16- user :'asldkfjsadlfkj'
17- } ) ;
18- assert . emits ( client , 'error' ) ;
19- client . connect ( ) ;
20- } ) ;
216
227var createErorrClient = function ( ) {
238 var client = helper . client ( ) ;
@@ -33,7 +18,7 @@ test('error handling', function() {
3318 test ( 'within a simple query' , function ( ) {
3419 var client = createErorrClient ( ) ;
3520
36- var query = client . query ( "select omfg from yodas_dsflsd where pixistix = 'zoiks!!!'" ) ;
21+ var query = client . query ( new pg . Query ( "select eeeee from yodas_dsflsd where pixistix = 'zoiks!!!'" ) ) ;
3722
3823 assert . emits ( query , 'error' , function ( error ) {
3924 assert . equal ( error . severity , "ERROR" ) ;
@@ -52,17 +37,17 @@ test('error handling', function() {
5237
5338 var ensureFuture = function ( testClient ) {
5439 test ( "client can issue more queries successfully" , function ( ) {
55- var goodQuery = testClient . query ( "select age from boom" ) ;
40+ var goodQuery = testClient . query ( new pg . Query ( "select age from boom" ) ) ;
5641 assert . emits ( goodQuery , 'row' , function ( row ) {
5742 assert . equal ( row . age , 28 ) ;
5843 } ) ;
5944 } ) ;
6045 } ;
6146
62- var query = client . query ( {
47+ var query = client . query ( new pg . Query ( {
6348 text : "select * from bang where name = $1" ,
6449 values : [ '0' ]
65- } ) ;
50+ } ) ) ;
6651
6752 test ( "query emits the error" , function ( ) {
6853 assert . emits ( query , 'error' , function ( err ) {
@@ -72,10 +57,10 @@ test('error handling', function() {
7257
7358 test ( "when a query is binding" , function ( ) {
7459
75- var query = client . query ( {
60+ var query = client . query ( new pg . Query ( {
7661 text : 'select * from boom where age = $1' ,
7762 values : [ 'asldkfjasdf' ]
78- } ) ;
63+ } ) ) ;
7964
8065 test ( "query emits the error" , function ( ) {
8166
0 commit comments