diff options
| author | Maximilian Krambach <[email protected]> | 2018-09-19 08:56:36 +0000 |
|---|---|---|
| committer | Maximilian Krambach <[email protected]> | 2018-09-19 08:56:36 +0000 |
| commit | 7f149586062ebae8114f64078771cb25579f5003 (patch) | |
| tree | afb8f87c0a8195ce8cf320115edc80019c9fd0af /lang/js/unittests.js | |
| parent | docs: python bindings (diff) | |
| download | gpgme-7f149586062ebae8114f64078771cb25579f5003.tar.gz gpgme-7f149586062ebae8114f64078771cb25579f5003.zip | |
js: add configuration option on startup
--
* src/index.js: Added an optional configuration object for the startup.
* configuration: timeout - the initial check for a connection ran into
timeouts on slower testing machines. 500ms for initial startup is
not sufficient everywhere. The default timeout was raised to 1000ms,
and as an option this timeout can be increased even further.
* BrowsertestExtension: Set the initial connection timeouts to 2
seconds, to be able to test on slower machines.
Diffstat (limited to '')
| -rw-r--r-- | lang/js/unittests.js | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/lang/js/unittests.js b/lang/js/unittests.js index de06320e..f28be76a 100644 --- a/lang/js/unittests.js +++ b/lang/js/unittests.js @@ -34,34 +34,38 @@ import { GPGME_Message, createMessage } from './src/Message'; mocha.setup('bdd'); const expect = chai.expect; chai.config.includeStack = true; +const connectionTimeout = 2000; function unittests (){ describe('Connection testing', function (){ it('Connecting', function (done) { let conn0 = new Connection; - conn0.checkConnection().then(function (answer) { - expect(answer).to.not.be.empty; - expect(answer.gpgme).to.not.be.undefined; - expect(answer.gpgme).to.be.a('string'); - expect(answer.info).to.be.an('Array'); - expect(conn0.disconnect).to.be.a('function'); - expect(conn0.post).to.be.a('function'); - done(); - }); + conn0.checkConnection(true, connectionTimeout).then( + function (answer) { + expect(answer).to.not.be.empty; + expect(answer.gpgme).to.not.be.undefined; + expect(answer.gpgme).to.be.a('string'); + expect(answer.info).to.be.an('Array'); + expect(conn0.disconnect).to.be.a('function'); + expect(conn0.post).to.be.a('function'); + done(); + }); }); it('Disconnecting', function (done) { let conn0 = new Connection; - conn0.checkConnection(false).then(function (answer) { - expect(answer).to.be.true; - conn0.disconnect(); - conn0.checkConnection(false).then(function (result) { - expect(result).to.be.false; - done(); + conn0.checkConnection(false, connectionTimeout).then( + function (answer) { + expect(answer).to.be.true; + conn0.disconnect(); + conn0.checkConnection(false, connectionTimeout).then( + function (result) { + expect(result).to.be.false; + done(); + }); }); - }); }); }); |
