Просмотр исходного кода

using done() instead of promise, to enforce mocha to wait on the tests

El RIDO 8 лет назад
Родитель
Сommit
f3eaee206c
1 измененных файлов с 8 добавлено и 6 удалено
  1. 8 6
      js/test/CryptTool.js

+ 8 - 6
js/test/CryptTool.js

@@ -31,14 +31,14 @@ describe('CryptTool', function () {
         // SJCL based pastes still works
         it(
             'supports PrivateBin v1 ciphertext (SJCL & browser atob)',
-            function () {
+            function (done) {
                 delete global.Base64;
                 var clean = jsdom();
                 window.crypto = new WebCrypto();
 
                 // Of course you can easily decipher the following texts, if you like.
                 // Bonus points for finding their sources and hidden meanings.
-                return $.PrivateBin.CryptTool.decipher(
+                $.PrivateBin.CryptTool.decipher(
                     '6t2qsmLyfXIokNCL+3/yl15rfTUBQvm5SOnFPvNE7Q8=',
                     // -- "That's amazing. I've got the same combination on my luggage."
                     Array.apply(0, Array(6)).map(function(_,b) { return b + 1; }).join(''),
@@ -70,7 +70,7 @@ describe('CryptTool', function () {
                     'C5fARPJ4F2BIWgzgzkNj+dVjusft2XnziamWdbS5u3kuRlVuz5LQj+R5' +
                     'imnqQAincdZTkTT1nYx+DatlOLllCYIHffpI="}'
                 ).then(function(paste1) {
-                    return $.PrivateBin.CryptTool.decipher(
+                    $.PrivateBin.CryptTool.decipher(
                         's9pmKZKOBN7EVvHpTA8jjLFH3Xlz/0l8lB4+ONPACrM=',
                         '', // no password
                         '{"iv":"WA42mdxIVXUwBqZu7JYNiw==","v":1,"iter":10000,"ks"' +
@@ -101,6 +101,7 @@ describe('CryptTool', function () {
                             paste1.includes('securely packed in iron') &&
                             paste2.includes('Sol is right')
                         );
+                        done();
                     });
                 });
             }
@@ -108,14 +109,14 @@ describe('CryptTool', function () {
 
         it(
             'supports ZeroBin ciphertext (SJCL & Base64 1.7)',
-            function () {
+            function (done) {
                 global.Base64 = require('../base64-1.7').Base64;
                 var clean = jsdom();
                 window.crypto = new WebCrypto();
 
                 // Of course you can easily decipher the following texts, if you like.
                 // Bonus points for finding their sources and hidden meanings.
-                return $.PrivateBin.CryptTool.decipher(
+                $.PrivateBin.CryptTool.decipher(
                     '6t2qsmLyfXIokNCL+3/yl15rfTUBQvm5SOnFPvNE7Q8=',
                     // -- "That's amazing. I've got the same combination on my luggage."
                     Array.apply(0, Array(6)).map(function(_,b) { return b + 1; }).join(''),
@@ -139,7 +140,7 @@ describe('CryptTool', function () {
                     'V37AeiNoD2PcI6ZcHbRdPa+XRrRcJhSPPW7UQ0z4OvBfjdu/w390QxAx' +
                     'SxvZewoh49fKKB6hTsRnZb4tpHkjlww=="}'
                 ).then(function(paste1) {
-                    return $.PrivateBin.CryptTool.decipher(
+                    $.PrivateBin.CryptTool.decipher(
                         's9pmKZKOBN7EVvHpTA8jjLFH3Xlz/0l8lB4+ONPACrM=',
                         '', // no password
                         '{"iv":"Z7lAZQbkrqGMvruxoSm6Pw==","v":1,"iter":10000,"ks"' +
@@ -164,6 +165,7 @@ describe('CryptTool', function () {
                             paste1.includes('securely packed in iron') &&
                             paste2.includes('Sol is right')
                         );
+                        done();
                     });
                 });
             }