From 8f3d83e5f0903323ec92f588f60dcecb0ae96de4 Mon Sep 17 00:00:00 2001 From: Maximilian Krambach Date: Mon, 7 May 2018 18:27:25 +0200 Subject: js: fixing errors found by testing: encrypt/decrypt -- * Key.js: Error code for wrong parameter in createKey should be "PARAM_WRONG" * Helpers.js: The property openpgpjs-like Objects were checked for in toKeyIdArray was not defined. * src/permittedOperations.js: updated more expectations and assumptions for the native API * new Problems: - There seems to be a message size limit of about 21 MB for nativeMessaging, much lower than the documented 4GB. - Some bytes are lost with random data in an encrypt-decrypt roundtrip. The culprit is unclear. --- lang/js/unittests.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lang/js/unittests.js') diff --git a/lang/js/unittests.js b/lang/js/unittests.js index 6c0d1890..c437d599 100644 --- a/lang/js/unittests.js +++ b/lang/js/unittests.js @@ -130,7 +130,6 @@ function unittests (){ let test0 = toKeyIdArray(hp.valid_openpgplike); expect(test0).to.be.an('array').with.lengthOf(1); - console.log(test0); expect(test0).to.include( hp.valid_openpgplike.primaryKey.getFingerprint()); }); @@ -255,7 +254,7 @@ function unittests (){ expect(test0.isComplete).to.be.false; }); - it('Message is complete after setting mandatoy data', function(){ + it('Message is complete after setting mandatory data', function(){ let test0 = createMessage('encrypt'); test0.setParameter('data', mp.valid_encrypt_data); test0.setParameter('keys', hp.validFingerprints); @@ -263,6 +262,13 @@ function unittests (){ expect(test0.isComplete).to.be.true; }); + it('Message is not complete after mandatory data is empty', function(){ + let test0 = createMessage('encrypt'); + test0.setParameter('data', ''); + test0.setParameter('keys', hp.validFingerprints); + expect(test0.isComplete).to.be.false; + }); + it('Complete Message contains the data that was set', function(){ let test0 = createMessage('encrypt'); test0.setParameter('data', mp.valid_encrypt_data); @@ -315,7 +321,6 @@ function unittests (){ }); }); - mocha.run(); } export default {unittests}; \ No newline at end of file -- cgit v1.2.3