From f0409bbdafcbd4f8b0be099a6b3ce0d5352c9bcd Mon Sep 17 00:00:00 2001 From: Maximilian Krambach Date: Wed, 22 Aug 2018 18:37:46 +0200 Subject: js: make method parameters objects -- * As requested by using parties, the options to be passed into the methods are now objects, with the objects' properties better describing what they do, and to avoid the need to type several nulls in a method call if one wants the last parameter. - src/Keyring.js, src/gpgme.js: Changed parameters and their validations - BrowserTest/*.js Had to adapt quite some calls to the new format --- lang/js/BrowserTestExtension/tests/decryptTest.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'lang/js/BrowserTestExtension/tests/decryptTest.js') diff --git a/lang/js/BrowserTestExtension/tests/decryptTest.js b/lang/js/BrowserTestExtension/tests/decryptTest.js index ea887491..8852cb6a 100644 --- a/lang/js/BrowserTestExtension/tests/decryptTest.js +++ b/lang/js/BrowserTestExtension/tests/decryptTest.js @@ -38,7 +38,7 @@ describe('Decryption', function () { it('Decryption of random string fails', function (done) { let data = bigString(20 * 1024); - context.decrypt(data).then( + context.decrypt({ data: data }).then( function (){}, function (error){ expect(error).to.be.an('error'); @@ -49,21 +49,22 @@ describe('Decryption', function () { it('Decryption of slightly corrupted message fails', function (done) { const data = bigString(10000); - context.encrypt(data, good_fpr).then(function (enc){ - context.decrypt(sabotageMsg(enc.data)).then( - function (){}, - function (error){ - expect(error).to.be.an('error'); - expect(error.code).to.equal('GNUPG_ERROR'); - done(); - }); - }); + context.encrypt({ data: data, publicKeys:good_fpr }).then( + function (enc){ + context.decrypt({ data: sabotageMsg(enc.data) }).then( + function (){}, + function (error){ + expect(error).to.be.an('error'); + expect(error.code).to.equal('GNUPG_ERROR'); + done(); + }); + }); }).timeout(5000); it('decrypt/verify operations return proper information', function (done){ const data = inputvalues.encryptSignedMessage; - context.decrypt(data).then(function (result){ + context.decrypt({ data: data }).then(function (result){ expect(result).to.be.an('object'); expect(result.signatures).to.be.an('object'); expect(result.signatures.all_valid).to.be.true; -- cgit v1.2.3