diff options
author | Maximilian Krambach <[email protected]> | 2018-05-03 16:03:22 +0000 |
---|---|---|
committer | Maximilian Krambach <[email protected]> | 2018-05-03 16:03:22 +0000 |
commit | c755287ba845c4cbbf1d50e5aafecb2e687c7ac9 (patch) | |
tree | 6b174738ce28aef4bdc29be8afa9e87db9fcaa69 /lang/js/src/Key.js | |
parent | js: changed Key class stub (diff) | |
download | gpgme-c755287ba845c4cbbf1d50e5aafecb2e687c7ac9.tar.gz gpgme-c755287ba845c4cbbf1d50e5aafecb2e687c7ac9.zip |
js: Added browser testing for unit tests
--
* Added unittests to be run inside a Browser. To be able to access
the non-exposed functions and classes, a testing bundle will be
created, containing the tests (unittests.js) and the items to be
tested.
* src/Helpelpers, src/Key, src/Keyring: fixed some errors found
during testing.
Diffstat (limited to '')
-rw-r--r-- | lang/js/src/Key.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lang/js/src/Key.js b/lang/js/src/Key.js index 1e0d3195..6d3cf17d 100644 --- a/lang/js/src/Key.js +++ b/lang/js/src/Key.js @@ -61,6 +61,9 @@ export class GPGME_Key { } get connection(){ + if (!this._fingerprint){ + return gpgme_error('KEY_INVALID'); + } if (!this._connection instanceof Connection){ return gpgme_error('CONN_NO_CONNECT'); } else { @@ -75,6 +78,9 @@ export class GPGME_Key { } get fingerprint(){ + if (!this._fingerprint){ + return gpgme_error('KEY_INVALID'); + } return this._fingerprint; } @@ -125,7 +131,7 @@ export class GPGME_Key { let msg = createMessage ('export_key'); msg.setParameter('armor', true); if (msg instanceof Error){ - return gpgme_error('INVALID_KEY'); + return gpgme_error('KEY_INVALID'); } this.connection.post(msg).then(function(result){ return result.data; @@ -203,6 +209,9 @@ export class GPGME_Key { * TODO: check if Promise.then(return) */ checkKey(property){ + if (!this._fingerprint){ + return gpgme_error('KEY_INVALID'); + } return gpgme_error('NOT_YET_IMPLEMENTED'); // TODO: async is not what is to be ecpected from Key information :( if (!property || typeof(property) !== 'string' || |