Skip to content

Commit d6d26a3

Browse files
author
Devendra
committed
modifying tests
1 parent d58c536 commit d6d26a3

1 file changed

Lines changed: 16 additions & 11 deletions

File tree

web/tests/qunit-tests.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@ function pubnub_test_all(test_name, test_func) {
7272
pubnub_test(test_name, test_func);
7373
pubnub_test(test_name, test_func, {jsonp : true});
7474
pubnub_test(test_name, test_func, {ssl : true});
75-
pubnub_test(test_name, test_func, {presence : function(r){console.log(JSON.stringify(r));ok(false)}});
75+
pubnub_test(test_name, test_func, {
76+
presence : function(r){
77+
console.log(JSON.stringify(r));
78+
if (!r.action) ok(false);
79+
}
80+
});
7681
pubnub_test(test_name, test_func, {jsonp : true, ssl : true});
7782
}
7883

@@ -401,7 +406,7 @@ pubnub_test_all("publish() should publish strings without error (Encryption Enab
401406
}, config);
402407
});
403408

404-
pubnub_test_all("both encrypted and unencrypted messages should be received on a channel with cipher key", function(config) {
409+
pubnub_test_all("encrypted and unencrypted messages should be received on a channel with cipher key", function(config) {
405410

406411
var pubnub = _pubnub({
407412
publish_key: test_publish_key,
@@ -418,7 +423,7 @@ pubnub_test_all("both encrypted and unencrypted messages should be received on a
418423
expect(3);
419424
stop(2);
420425
var count = 0;
421-
var ch = channel + '-both-' + ++count;
426+
var ch = channel + '-both-' + ++count + Math.random();
422427

423428
_pubnub_subscribe(pubnub_enc, { channel : ch,
424429
connect : function(response) {
@@ -461,7 +466,7 @@ pubnub_test_all("test global cipher key", function(config) {
461466
expect(3);
462467
stop(2);
463468
var count = 0;
464-
var ch = channel + '-global-' + ++count;
469+
var ch = channel + '-global-' + ++count + Math.random();
465470
_pubnub_subscribe(pubnub_enc, { channel : ch,
466471
cipher_key : 'local_cipher_key',
467472
connect : function(response) {
@@ -907,7 +912,7 @@ pubnub_test_all("#here_now() should show occupancy 1 when 1 user subscribed to c
907912

908913
expect(3);
909914
stop(1);
910-
var ch = channel + '-' + 'here-now' ;
915+
var ch = channel + '-' + 'here-now' + Math.random();
911916
_pubnub_subscribe(pubnub, {channel : ch ,
912917
connect : function(response) {
913918
setTimeout(function() {
@@ -939,7 +944,7 @@ pubnub_test_all("#here_now() should show occupancy 1 when 1 user subscribed to c
939944

940945
expect(5);
941946
stop(1);
942-
var ch = channel + '-' + 'here-now' ;
947+
var ch = channel + '-' + 'here-now' + Math.random();
943948
_pubnub_subscribe(pubnub, {channel : ch ,
944949
connect : function(response) {
945950
setTimeout(function() {
@@ -1196,23 +1201,23 @@ pubnub_test_all('Encryption tests', function(config) {
11961201
//ok(aes.raw_encrypt(test_plain_unicode_1) == test_cipher_unicode_1, "AES Unicode Encryption Test 1");
11971202
ok(pubnub_enc.raw_decrypt(test_cipher_string_1) == test_plain_string_1, "AES String Decryption Test 1");
11981203
ok(pubnub_enc.raw_decrypt(test_cipher_string_2) == test_plain_string_2, "AES String Decryption Test 2");
1199-
ok(JSON.stringify(aes.raw_decrypt(test_cipher_object_1)) == JSON.stringify(test_plain_object_1), "AES Object Decryption Test 1");
1200-
ok(JSON.stringify(aes.raw_decrypt(test_cipher_object_2)) == JSON.stringify(test_plain_object_2), "AES Object Decryption Test 2");
1204+
ok(JSON.stringify(pubnub_enc.raw_decrypt(test_cipher_object_1)) == JSON.stringify(test_plain_object_1), "AES Object Decryption Test 1");
1205+
ok(JSON.stringify(pubnub_enc.raw_decrypt(test_cipher_object_2)) == JSON.stringify(test_plain_object_2), "AES Object Decryption Test 2");
12011206
ok(pubnub_enc.raw_decrypt(test_cipher_unicode_1) == test_plain_unicode_1, "AES Unicode Decryption Test 1");
12021207

1203-
aes_channel = channel + "aes-channel";
1208+
aes_channel = channel + "aes-channel" + Math.random();
12041209
_pubnub_subscribe(pubnub_enc, {
12051210
channel: aes_channel,
12061211
connect: function() {
12071212
setTimeout(function() {
1208-
aes.publish({
1213+
pubnub_enc.publish({
12091214
channel: aes_channel,
12101215
message: { test: "test" },
12111216
callback: function (response) {
12121217
ok(response[0], 'AES Successful Publish ' + response[0]);
12131218
ok(response[1], 'AES Success With Demo ' + response[1]);
12141219
setTimeout(function() {
1215-
aes.history({
1220+
pubnub_enc.history({
12161221
limit: 1,
12171222
reverse: false,
12181223
channel: aes_channel,

0 commit comments

Comments
 (0)