diff options
author | Maximilian Krambach <[email protected]> | 2018-08-30 13:00:19 +0000 |
---|---|---|
committer | Maximilian Krambach <[email protected]> | 2018-08-30 13:00:19 +0000 |
commit | 3201ded91f91fcdf501ad966380b6ff29d798b09 (patch) | |
tree | 31db36d9654b9e5f48475e9723e2fa097ca6c4e0 /lang/js/BrowserTestExtension/tests/decryptTest.js | |
parent | js: add encoding parameter for encrypt return (diff) | |
download | gpgme-3201ded91f91fcdf501ad966380b6ff29d798b09.tar.gz gpgme-3201ded91f91fcdf501ad966380b6ff29d798b09.zip |
js: add tests
--
* BrowserTestExtension/tests:
- decryptTest.js: Check Decryption and return values of binary data
- encryptTest.js: Return data type of armored/non-armored encryption
- added a small encoded input png for testing
* DemoExtension/maindemo.js: Fixed unexpected usage of the Demo encrypt
(non-armored)
Diffstat (limited to 'lang/js/BrowserTestExtension/tests/decryptTest.js')
-rw-r--r-- | lang/js/BrowserTestExtension/tests/decryptTest.js | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/lang/js/BrowserTestExtension/tests/decryptTest.js b/lang/js/BrowserTestExtension/tests/decryptTest.js index 8852cb6a..606d96ed 100644 --- a/lang/js/BrowserTestExtension/tests/decryptTest.js +++ b/lang/js/BrowserTestExtension/tests/decryptTest.js @@ -22,7 +22,7 @@ */ /* global describe, it, before, expect, Gpgmejs */ -/* global bigString, inputvalues, sabotageMsg*/ +/* global bigString, inputvalues, sabotageMsg, binaryData */ describe('Decryption', function () { let context = null; @@ -76,4 +76,26 @@ describe('Decryption', function () { done(); }); }); + + it('decrypt of a png, result as base64', function (done){ + const data = binaryData.encryptedArmored; + context.decrypt({ data: data, expect: 'base64' }) + .then(function (result){ + expect(result.data).to.be.a('String'); + expect(result.data).to.equal(binaryData.base64); + expect(result.format).to.equal('base64'); + done(); + }); + }); + + it('decrypt of a png, result as Uint8Array', function (done){ + const data = binaryData.encryptedArmored; + context.decrypt({ data: data, expect: 'uint8' }) + .then(function (result){ + expect(result.data).to.be.an('Uint8Array'); + expect(result.format).to.equal('uint8'); + done(); + }); + }); + });
\ No newline at end of file |