Skip to content

Commit cdbb574

Browse files
author
Devendra
committed
fixing tests based on new changes
1 parent 3b200f3 commit cdbb574

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

node.js/tests/test.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var pubnub = PUBNUB.init({
66
subscribe_key : 'demo'
77
});
88

9-
var pubnub_enc = PUBNUB.secure({
9+
var pubnub_enc = PUBNUB({
1010
publish_key : 'demo',
1111
subscribe_key : 'demo',
1212
cipher_key : 'enigma'
@@ -24,7 +24,7 @@ describe('Pubnub', function() {
2424
this.timeout(180000);
2525

2626
describe('#subscribe()', function(){
27-
it('should call error callback on decryption error', function(done){
27+
it('should pass plain text to callback on decryption error', function(done){
2828
var ch = channel + '-' + ++count;
2929
pubnub_enc.subscribe({channel : ch ,
3030
connect : function(response) {
@@ -35,12 +35,12 @@ describe('Pubnub', function() {
3535
});
3636
},
3737
callback : function(response) {
38-
assert.ok(false);
38+
assert.deepEqual(response,message_string);
3939
pubnub_enc.unsubscribe({channel : ch});
4040
done();
4141
},
4242
error : function(response) {
43-
assert.deepEqual(response['error'],"DECRYPT_ERROR");
43+
assert.ok(false);
4444
pubnub_enc.unsubscribe({channel : ch});
4545
done();
4646
}
@@ -248,15 +248,16 @@ describe('Pubnub', function() {
248248
})
249249
},5000);
250250
})
251-
it('should call error callbacks for messages which could not be decrypted when encryption is enabled', function(done) {
251+
it('should pass on plain text for messages which could not be decrypted when encryption is enabled', function(done) {
252252
this.timeout(40000);
253253
setTimeout(function() {
254254
pubnub_enc.history({channel : history_channel,
255255
callback : function(response) {
256-
assert.deepEqual(response[0].length, 2);
256+
assert.deepEqual(response[0].length, 6);
257+
done();
257258
},
258259
error : function(response) {
259-
assert.deepEqual(response[0].length, 4);
260+
assert.ok(false);
260261
done();
261262
}
262263
})

0 commit comments

Comments
 (0)