From 30b7be0781171b2655e5f305e80dca03fbfaccae Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sat, 1 Sep 2018 22:55:52 +0200 Subject: [PATCH] async test, finding error for rngState 00b15fc0a8247e693d, due to failure in decompressing --- js/common.js | 2 +- js/test/CryptTool.js | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/js/common.js b/js/common.js index 6aa43bac..95cfe815 100644 --- a/js/common.js +++ b/js/common.js @@ -56,7 +56,7 @@ var a2zString = ['a','b','c','d','e','f','g','h','i','j','k','l','m', mimeLine = ''; // redirect console messages to log file -console.info = console.warn = console.error = function () { +console.info = console.warn = function () { logFile.write(Array.prototype.slice.call(arguments).join('') + '\n'); }; diff --git a/js/test/CryptTool.js b/js/test/CryptTool.js index d4fbbf0f..0cc81950 100644 --- a/js/test/CryptTool.js +++ b/js/test/CryptTool.js @@ -11,12 +11,18 @@ describe('CryptTool', function () { 'string', 'string', 'string', - async function (key, password, message) { - return message.trim() === await $.PrivateBin.CryptTool.decipher( - key, - password, - await $.PrivateBin.CryptTool.cipher(key, password, message.trim()) - ); + function (key, password, message) { + message = message.trim(); + return $.PrivateBin.CryptTool.cipher( + key, password, message + ).then(function(ciphertext) { + return $.PrivateBin.CryptTool.decipher( + key, password, ciphertext + ).then(function(plaintext) { + if (message !== plaintext) console.log([message, plaintext]); + return message === plaintext; + }); + }); } )); });