aboutsummaryrefslogtreecommitdiffstats
path: root/lang/js/BrowserTestExtension
diff options
context:
space:
mode:
authorMaximilian Krambach <[email protected]>2019-07-03 14:19:44 +0000
committerMaximilian Krambach <[email protected]>2019-07-03 14:19:44 +0000
commited1dffb4748e686e525883b5efde9288b8e003d3 (patch)
tree261bdd49bb2334c8d14a3844aa3afb6a00cb2a32 /lang/js/BrowserTestExtension
parentjs: Error handling for browser errors (diff)
downloadgpgme-ed1dffb4748e686e525883b5efde9288b8e003d3.tar.gz
gpgme-ed1dffb4748e686e525883b5efde9288b8e003d3.zip
js: improve connection check
-- * Connection.js: In some cases, the browser disconnect does not happen inmediately (e.g. wrong extension for the app). I added a delay of 25 ms to see if the connection was closed by the browser. Also, I tried to make the checkConnection more readable.
Diffstat (limited to 'lang/js/BrowserTestExtension')
-rw-r--r--lang/js/BrowserTestExtension/tests/startup.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/lang/js/BrowserTestExtension/tests/startup.js b/lang/js/BrowserTestExtension/tests/startup.js
index 34333e6b..c1c576cc 100644
--- a/lang/js/BrowserTestExtension/tests/startup.js
+++ b/lang/js/BrowserTestExtension/tests/startup.js
@@ -44,4 +44,16 @@ describe('GPGME context', function (){
done();
});
});
+
+ it('Error message on unsuccessful connection (timeout)', function (done) {
+ let prm = Gpgmejs.init({ timeout: 1 });
+ prm.then(
+ null,
+ function (error){
+ expect(error).to.be.an('error');
+ expect(error.code).to.equal('CONN_TIMEOUT');
+ done();
+ }
+ );
+ });
}); \ No newline at end of file