diff options
author | Maximilian Krambach <[email protected]> | 2018-08-22 16:37:46 +0000 |
---|---|---|
committer | Maximilian Krambach <[email protected]> | 2018-08-22 16:37:46 +0000 |
commit | f0409bbdafcbd4f8b0be099a6b3ce0d5352c9bcd (patch) | |
tree | fc94d23b0abef3c9e7c73d8a0165262f16e575e7 /lang/js/BrowserTestExtension/tests/KeyImportExport.js | |
parent | js: improve decryption performance (diff) | |
download | gpgme-f0409bbdafcbd4f8b0be099a6b3ce0d5352c9bcd.tar.gz gpgme-f0409bbdafcbd4f8b0be099a6b3ce0d5352c9bcd.zip |
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
Diffstat (limited to 'lang/js/BrowserTestExtension/tests/KeyImportExport.js')
-rw-r--r-- | lang/js/BrowserTestExtension/tests/KeyImportExport.js | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/lang/js/BrowserTestExtension/tests/KeyImportExport.js b/lang/js/BrowserTestExtension/tests/KeyImportExport.js index f52b790a..f57877f4 100644 --- a/lang/js/BrowserTestExtension/tests/KeyImportExport.js +++ b/lang/js/BrowserTestExtension/tests/KeyImportExport.js @@ -35,7 +35,7 @@ describe('Key importing', function () { const prm = Gpgmejs.init(); prm.then(function (gpgmejs){ context = gpgmejs; - context.Keyring.getKeys(fpr).then( + context.Keyring.getKeys({ pattern: fpr }).then( function (result){ if (result.length === 1) { result[0].delete().then(function (){ @@ -52,7 +52,7 @@ describe('Key importing', function () { afterEach(function (done){ // delete the test key if still present - context.Keyring.getKeys(fpr).then( + context.Keyring.getKeys({ pattern: fpr }).then( function (result){ if (result.length === 1) { result[0].delete().then(function (){ @@ -67,7 +67,7 @@ describe('Key importing', function () { }); it('Importing Key', function (done) { - context.Keyring.getKeys(fpr).then(function (result){ + context.Keyring.getKeys({ pattern: fpr }).then(function (result){ expect(result).to.be.an('array'); expect(result.length).to.equal(0); context.Keyring.importKey(pubKey).then(function (result){ @@ -127,23 +127,26 @@ describe('Key importing', function () { it('exporting armored Key with getKeysArmored', function (done) { context.Keyring.importKey(pubKey).then(function (){ - context.Keyring.getKeysArmored(fpr).then(function (result){ - expect(result).to.be.an('object'); - expect(result.armored).to.be.a('string'); - expect(result.secret_fprs).to.be.undefined; - done(); - }); + context.Keyring.getKeysArmored({ pattern: fpr }) + .then(function (result){ + expect(result).to.be.an('object'); + expect(result.armored).to.be.a('string'); + expect(result.secret_fprs).to.be.undefined; + done(); + }); }); }); it('Exporting Key (including secret fingerprints)', function (done) { const key_secret = inputvalues.encrypt.good.fingerprint; - context.Keyring.getKeysArmored(key_secret, true).then(function (result){ - expect(result).to.be.an('object'); - expect(result.armored).to.be.a('string'); - expect(result.secret_fprs).to.be.an('array'); - expect(result.secret_fprs[0]).to.equal(key_secret); - done(); - }); + context.Keyring.getKeysArmored({ + pattern: key_secret, with_secret_fpr: true }) + .then(function (result){ + expect(result).to.be.an('object'); + expect(result.armored).to.be.a('string'); + expect(result.secret_fprs).to.be.an('array'); + expect(result.secret_fprs[0]).to.equal(key_secret); + done(); + }); }); });
\ No newline at end of file |