[Pkg-javascript-commits] [sockjs-client] 231/350: Handle if echo test has timed out.
tonnerre at ancient-solutions.com
tonnerre at ancient-solutions.com
Fri Aug 5 01:04:24 UTC 2016
This is an automated email from the git hooks/post-receive script.
tonnerre-guest pushed a commit to branch upstream
in repository sockjs-client.
commit 3c040e4bdfeab70ec6a7fdd8e27a7f8fe1277226
Author: Bryce Kahle <bkahle at gmail.com>
Date: Thu Oct 23 17:31:51 2014 -0400
Handle if echo test has timed out.
---
lib/main.js | 2 +-
tests/lib/echo-tests.js | 10 +++++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/lib/main.js b/lib/main.js
index 1d7184e..cf2335a 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -343,7 +343,7 @@ SockJS.prototype._close = function(code, reason, wasClean) {
var e = new CloseEvent('close');
e.wasClean = wasClean || false;
- e.code = code;
+ e.code = code || 1000;
e.reason = reason;
this.dispatchEvent(e);
diff --git a/tests/lib/echo-tests.js b/tests/lib/echo-tests.js
index 952d761..08e45f2 100644
--- a/tests/lib/echo-tests.js
+++ b/tests/lib/echo-tests.js
@@ -7,7 +7,8 @@ var expect = require('expect.js')
function echoFactory(transport, messages, url) {
return function (done) {
- var title = this.runnable().fullTitle();
+ var test = this.runnable();
+ var title = test.fullTitle();
debug('start', title);
this.timeout(20000);
var msgs = messages.slice(0);
@@ -17,6 +18,9 @@ function echoFactory(transport, messages, url) {
sjs.send(msgs[0]);
};
sjs.onmessage = function (e) {
+ if (test.timedOut) {
+ return;
+ }
// TODO don't like having to force the element toString here
expect(e.data).to.eql('' + msgs[0]);
msgs.shift();
@@ -27,6 +31,10 @@ function echoFactory(transport, messages, url) {
}
};
sjs.onclose = function (e) {
+ if (test.timedOut) {
+ return;
+ }
+
expect(e.code).to.equal(1000);
expect(msgs).to.have.length(0);
done();
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/sockjs-client.git
More information about the Pkg-javascript-commits
mailing list