File tree 1 file changed +36
-0
lines changed
1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ var helper = require ( __dirname + "/../test-helper" ) ;
2
+ var Client = require ( __dirname + "/../../lib/native" ) ;
3
+ test ( 'COPY FROM events check' , function ( ) {
4
+ var con = new Client ( helper . config ) ,
5
+ stdinStream = con . copyFrom ( 'COPY person FROM STDIN' ) ;
6
+ assert . emits ( con , 'copyInResponse' ,
7
+ function ( ) {
8
+ stdinStream . end ( ) ;
9
+ } ,
10
+ "backend should emit copyInResponse after COPY FROM query"
11
+ ) ;
12
+ assert . emits ( con , '_readyForQuery' ,
13
+ function ( ) {
14
+ con . end ( ) ;
15
+ } ,
16
+ "backend should emit _readyForQuery after data will be coped to stdin stream"
17
+ ) ;
18
+ con . connect ( ) ;
19
+ } ) ;
20
+ test ( 'COPY TO events check' , function ( ) {
21
+ var con = new Client ( helper . config ) ,
22
+ stdoutStream = con . copyTo ( 'COPY person TO STDOUT' ) ;
23
+ assert . emits ( con , 'copyData' ,
24
+ function ( ) {
25
+ } ,
26
+ "backend should emit copyData on every data row"
27
+ ) ;
28
+ assert . emits ( con , '_readyForQuery' ,
29
+ function ( ) {
30
+ con . end ( ) ;
31
+ } ,
32
+ "backend should emit _readyForQuery after data will be coped to stdout stream"
33
+ ) ;
34
+ con . connect ( ) ;
35
+ } ) ;
36
+
You can’t perform that action at this time.
0 commit comments