File tree 1 file changed +44
-0
lines changed
test/integration/connection 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ var helper = require ( __dirname + "/test-helper" ) ;
2
+ var assert = require ( 'assert' ) ;
3
+
4
+ test ( 'COPY FROM events check' , function ( ) {
5
+ helper . connect ( function ( con ) {
6
+ var stdinStream = con . query ( 'COPY person FROM STDIN' ) ;
7
+ con . on ( 'copyInResponse' , function ( ) {
8
+ con . endCopyFrom ( ) ;
9
+ } ) ;
10
+ assert . emits ( con , 'copyInResponse' ,
11
+ function ( ) {
12
+ con . endCopyFrom ( ) ;
13
+ } ,
14
+ "backend should emit copyInResponse after COPY FROM query"
15
+ ) ;
16
+ assert . emits ( con , 'commandComplete' ,
17
+ function ( ) {
18
+ con . end ( ) ;
19
+ } ,
20
+ "backend should emit commandComplete after COPY FROM stream ends"
21
+ )
22
+ } ) ;
23
+ } ) ;
24
+ test ( 'COPY TO events check' , function ( ) {
25
+ helper . connect ( function ( con ) {
26
+ var stdoutStream = con . query ( 'COPY person TO STDOUT' ) ;
27
+ assert . emits ( con , 'copyOutResponse' ,
28
+ function ( ) {
29
+ } ,
30
+ "backend should emit copyOutResponse after COPY TO query"
31
+ ) ;
32
+ assert . emits ( con , 'copyData' ,
33
+ function ( ) {
34
+ } ,
35
+ "backend should emit copyData on every data row"
36
+ ) ;
37
+ assert . emits ( con , 'copyDone' ,
38
+ function ( ) {
39
+ con . end ( ) ;
40
+ } ,
41
+ "backend should emit copyDone after all data rows"
42
+ ) ;
43
+ } ) ;
44
+ } ) ;
You can’t perform that action at this time.
0 commit comments