From ed1dffb4748e686e525883b5efde9288b8e003d3 Mon Sep 17 00:00:00 2001 From: Maximilian Krambach Date: Wed, 3 Jul 2019 16:19:44 +0200 Subject: 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. --- lang/js/BrowserTestExtension/tests/startup.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lang/js/BrowserTestExtension/tests/startup.js') 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 -- cgit v1.2.3