@@ -133,28 +133,39 @@ describe('Pubnub', function () {
133
133
pubnub_enc . unsubscribe ( { channel : ch } ) ;
134
134
done ( ) ;
135
135
}
136
-
137
136
} )
138
137
} ) ;
139
138
140
139
it ( 'should take an error callback which will be invoked if channel permission not there' , function ( done ) {
141
140
var channel = 'channel' + Date . now ( ) ;
142
141
var auth_key = 'abcd' ;
143
- pubnub_pam . subscribe ( {
144
- 'auth_key' : auth_key ,
145
- 'channel' : channel ,
146
- 'error' : function ( r ) {
147
- assert . deepEqual ( r [ 'message' ] , 'Forbidden' ) ;
148
- assert . ok ( r [ 'payload' ] , "Payload should be there in error response" ) ;
149
- assert . ok ( r [ 'payload' ] [ 'channels' ] , "Channels should be there in error payload" ) ;
150
- assert . ok ( in_list_deep ( r [ 'payload' ] [ 'channels' ] , channel ) , "Channel should be there in channel list" ) ;
151
- pubnub_pam . unsubscribe ( { 'channel' : channel } ) ;
152
- done ( ) ;
153
- } ,
154
- 'callback' : function ( ) {
155
- done ( new Error ( "Callback should not get invoked if permission not there" ) ) ;
142
+
143
+ this . timeout ( 3000 ) ;
144
+
145
+ pubnub_pam . revoke ( {
146
+ auth_key : auth_key ,
147
+ channel : channel ,
148
+ callback : function ( ) {
149
+ pubnub_pam . subscribe ( {
150
+ auth_key : auth_key ,
151
+ channel : channel ,
152
+ error : function ( r ) {
153
+ assert . deepEqual ( r [ 'message' ] , 'Forbidden' ) ;
154
+ assert . ok ( r [ 'payload' ] , "Payload should be there in error response" ) ;
155
+ assert . ok ( r [ 'payload' ] [ 'channels' ] , "Channels should be there in error payload" ) ;
156
+ assert . ok ( in_list_deep ( r [ 'payload' ] [ 'channels' ] , channel ) , "Channel should be there in channel list" ) ;
157
+ pubnub_pam . unsubscribe ( { 'channel' : channel } ) ;
158
+ done ( ) ;
159
+ } ,
160
+ callback : function ( ) {
161
+ done ( new Error ( "Callback should not get invoked if permission not there" ) ) ;
162
+ } ,
163
+ connect : function ( ) {
164
+ done ( new Error ( "Connect should not get invoked if permission not there" ) ) ;
165
+ }
166
+ } )
156
167
}
157
- } )
168
+ } ) ;
158
169
} ) ;
159
170
160
171
it ( "should not generate spurious presence events when adding new channels to subscribe in_list" , function ( done ) {
@@ -839,6 +850,8 @@ describe('Pubnub', function () {
839
850
build_u : true
840
851
} ) ;
841
852
853
+ this . timeout ( 15000 ) ;
854
+
842
855
for ( var i = 0 ; i < get_random ( 10 ) ; i ++ ) {
843
856
pubnub . _add_param ( 'a-' + get_random ( 1000 ) , Date . now ( ) ) ;
844
857
}
@@ -1239,6 +1252,9 @@ describe('Pubnub', function () {
1239
1252
done ( new Error ( "Unable to get history for the sub_key with granted read permissions" ) )
1240
1253
}
1241
1254
} ) ;
1255
+ } ,
1256
+ error : function ( ) {
1257
+ done ( new Error ( "Error in audit" ) )
1242
1258
}
1243
1259
} ) ;
1244
1260
}
0 commit comments