Permalink
Browse files

remove some es5isms in the tests

  • Loading branch information...
1 parent eb15f1e commit fd3f7fc6b57a5b45ef47858750911954efd5c956 @substack committed Dec 22, 2012
Showing with 8 additions and 7 deletions.
  1. +5 −5 test/emit.js
  2. +3 −2 test/middleware.js
View
@@ -8,9 +8,9 @@ test('emit events', function (t) {
var subs = [];
function publish (name) {
var args = [].slice.call(arguments, 1);
- subs.forEach(function (sub) {
- sub.emit(name, args);
- });
+ for (var i = 0; i < subs.length; i++) {
+ subs[i].emit(name, args);
+ }
}
var server = function () {
@@ -45,7 +45,7 @@ test('emit events', function (t) {
x.on('remote', function (remote) {
var em = new EventEmitter;
em.on('data', function (n) { xs.push(n) });
- remote.subscribe(em.emit.bind(em));
+ remote.subscribe(function () { return em.emit.apply(em, arguments) });
});
x.pipe(server()).pipe(x);
@@ -54,7 +54,7 @@ test('emit events', function (t) {
y.on('remote', function (remote) {
var em = new EventEmitter;
em.on('data', function (n) { ys.push(n) });
- remote.subscribe(em.emit.bind(em))
+ remote.subscribe(function () { return em.emit.apply(em, arguments) });
});
y.pipe(server()).pipe(y);
View
@@ -17,14 +17,15 @@ test('middleware', function (t) {
}, 1000);
var server = dnode(function (client, conn) {
+ var self = this;
t.ok(!conn.zing);
t.ok(!client.moo);
conn.on('remote', (function () {
clearTimeout(tr);
t.ok(conn.zing);
- t.ok(this.moo);
- }).bind(this));
+ t.ok(self.moo);
+ });
this.baz = 42;
});

0 comments on commit fd3f7fc

Please sign in to comment.