From 5779d87788c383cbd3bbb8cb65fb7ed0779910c8 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Wed, 15 May 2019 18:56:42 +0200 Subject: [PATCH] integrating compression test case that failed in rawdeflate in webcrypto + zlib testing, proving this fixes #328 --- js/test/CryptTool.js | 17 +++++++++++++++++ js/test/Truncation.js | 15 --------------- 2 files changed, 17 insertions(+), 15 deletions(-) delete mode 100644 js/test/Truncation.js diff --git a/js/test/CryptTool.js b/js/test/CryptTool.js index 3b8ae010..c6244751 100644 --- a/js/test/CryptTool.js +++ b/js/test/CryptTool.js @@ -174,6 +174,23 @@ describe('CryptTool', function () { }); } ); + + it('does not truncate messages', async function () { + let message = fs.readFileSync('test/compression-sample.txt', 'utf8'), + clean = jsdom(); + window.crypto = new WebCrypto(); + let cipherMessage = await $.PrivateBin.CryptTool.cipher( + 'foo', 'bar', message, [] + ), + plaintext = await $.PrivateBin.CryptTool.decipher( + 'foo', 'bar', cipherMessage + ); + clean(); + assert.strictEqual( + message, + plaintext + ); + }); }); describe('getSymmetricKey', function () { diff --git a/js/test/Truncation.js b/js/test/Truncation.js deleted file mode 100644 index 4eafa5fc..00000000 --- a/js/test/Truncation.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; -var common = require('../common'); - -describe('Compression', function () { - it('does not truncate messages', function () { - var message = fs.readFileSync('test/compression-sample.txt', 'utf8'); - assert.strictEqual( - message, - Base64.btou( RawDeflate.inflate( - RawDeflate.deflate( Base64.utob(message) ) - ) ) - ); - }); -}); -