Browse Source

integrating compression test case that failed in rawdeflate in webcrypto + zlib testing, proving this fixes #328

El RIDO 7 năm trước cách đây
mục cha
commit
5779d87788
2 tập tin đã thay đổi với 17 bổ sung15 xóa
  1. 17 0
      js/test/CryptTool.js
  2. 0 15
      js/test/Truncation.js

+ 17 - 0
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 () {

+ 0 - 15
js/test/Truncation.js

@@ -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) )
-            ) )
-        );
-    });
-});
-