File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,27 @@ test("simple query interface", function() {
36
36
} ) ;
37
37
} ) ;
38
38
39
+ test ( "simple query interface using addRow" , function ( ) {
40
+
41
+ var client = helper . client ( ) ;
42
+
43
+ var query = client . query ( "select name from person order by name" ) ;
44
+
45
+ client . on ( 'drain' , client . end . bind ( client ) ) ;
46
+
47
+ query . on ( 'row' , function ( row , result ) {
48
+ assert . ok ( result ) ;
49
+ result . addRow ( row ) ;
50
+ } ) ;
51
+
52
+ query . on ( 'end' , function ( result ) {
53
+ assert . lengthIs ( result . rows , 26 , "result returned wrong number of rows" ) ;
54
+ assert . lengthIs ( result . rows , result . rowCount ) ;
55
+ assert . equal ( result . rows [ 0 ] . name , "Aaron" ) ;
56
+ assert . equal ( result . rows [ 25 ] . name , "Zanzabar" ) ;
57
+ } ) ;
58
+ } ) ;
59
+
39
60
test ( "multiple simple queries" , function ( ) {
40
61
var client = helper . client ( ) ;
41
62
client . query ( { text : "create temp table bang(id serial, name varchar(5));insert into bang(name) VALUES('boom');" } )
You can’t perform that action at this time.
0 commit comments