@@ -16,28 +16,25 @@ test('emits notify message', function() {
16
16
client . query ( 'LISTEN boom' , assert . calls ( function ( ) {
17
17
var otherClient = helper . client ( ) ;
18
18
otherClient . query ( 'LISTEN boom' , assert . calls ( function ( ) {
19
- var afterNotify = function ( ) {
20
- assert . emits ( client , 'notification' , function ( msg ) {
19
+ assert . emits ( client , 'notification' , function ( msg ) {
20
+ //make sure PQfreemem doesn't invalidate string pointers
21
+ setTimeout ( function ( ) {
22
+ assert . equal ( msg . channel , 'boom' ) ;
23
+ assert . ok ( msg . payload == 'omg!' /*9.x*/ || msg . payload == '' /*8.x*/ , "expected blank payload or correct payload but got " + msg . message )
24
+ client . end ( )
25
+ } , 500 )
21
26
22
- //make sure PQfreemem doesn't invalidate string pointers
23
- setTimeout ( function ( ) {
24
- assert . equal ( msg . channel , 'boom' ) ;
25
- assert . ok ( msg . payload == 'omg!' /*9.x*/ || msg . payload == '' /*8.x*/ , "expected blank payload or correct payload but got " + msg . message )
26
- client . end ( )
27
- } , 500 )
27
+ } ) ;
28
+ assert . emits ( otherClient , 'notification' , function ( msg ) {
29
+ assert . equal ( msg . channel , 'boom' ) ;
30
+ otherClient . end ( ) ;
31
+ } ) ;
28
32
29
- } ) ;
30
- assert . emits ( otherClient , 'notification' , function ( msg ) {
31
- assert . equal ( msg . channel , 'boom' ) ;
32
- otherClient . end ( ) ;
33
- } ) ;
34
- }
35
33
client . query ( "NOTIFY boom, 'omg!'" , function ( err , q ) {
36
34
if ( err ) {
37
35
//notify not supported with payload on 8.x
38
36
client . query ( "NOTIFY boom" )
39
- }
40
- afterNotify ( ) ;
37
+ }
41
38
} ) ;
42
39
} ) ) ;
43
40
} ) ) ;
0 commit comments