aboutsummaryrefslogtreecommitdiffstats
path: root/lang/js/BrowserTestExtension/tests/encryptDecryptTest.js
diff options
context:
space:
mode:
authorMaximilian Krambach <[email protected]>2018-08-22 17:07:05 +0000
committerMaximilian Krambach <[email protected]>2018-08-22 17:07:05 +0000
commit24a00058652233775cbe51446cba337b70cefdf1 (patch)
tree49fea48a6334bc19f835cd5057c786ee49b6109c /lang/js/BrowserTestExtension/tests/encryptDecryptTest.js
parentjs: make method parameters objects (diff)
downloadgpgme-24a00058652233775cbe51446cba337b70cefdf1.tar.gz
gpgme-24a00058652233775cbe51446cba337b70cefdf1.zip
js: add decrypt result options
-- * As a decrypt result cannot be known beforehand, the decrypt operation may add an 'expect' property, taking either 'uint8' or 'base64', which will return the decrypted data in the appropiate formats. the return property 'format' will give a feedback on which option was taken. A test was added to reflect these changes.
Diffstat (limited to 'lang/js/BrowserTestExtension/tests/encryptDecryptTest.js')
-rw-r--r--lang/js/BrowserTestExtension/tests/encryptDecryptTest.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/lang/js/BrowserTestExtension/tests/encryptDecryptTest.js b/lang/js/BrowserTestExtension/tests/encryptDecryptTest.js
index 1efdf5cf..c10c5d06 100644
--- a/lang/js/BrowserTestExtension/tests/encryptDecryptTest.js
+++ b/lang/js/BrowserTestExtension/tests/encryptDecryptTest.js
@@ -144,6 +144,30 @@ describe('Encryption and Decryption', function (){
});
}).timeout(3000);
+ it('Random data, original data is and should stay base64 encoded',
+ function (done) {
+ let data = bigBoringString(0.001);
+ let b64data = btoa(data);
+ context.encrypt(
+ { data: b64data, publicKeys: good_fpr })
+ .then(function (answer) {
+ expect(answer).to.not.be.empty;
+ expect(answer.data).to.be.a('string');
+ expect(answer.data).to.include(
+ 'BEGIN PGP MESSAGE');
+ expect(answer.data).to.include(
+ 'END PGP MESSAGE');
+ context.decrypt({
+ data:answer.data, expect: 'base64' })
+ .then(function (result) {
+ expect(result).to.not.be.empty;
+ expect(result.data).to.be.a('string');
+ expect(result.data).to.equal(b64data);
+ done();
+ });
+ });
+ }).timeout(3000);
+
for (let j = 0; j < inputvalues.encrypt.good.data_nonascii_32.length; j++){
it('Roundtrip with >1MB non-ascii input meeting default chunksize (' +
(j + 1) + '/'