Permalink
Browse files

Make tests work with new versions of modules.

  • Loading branch information...
1 parent e7fc25e commit 3cbe1958ce0d0a5b42e1626c8e243a2a9ba36a49 @tristanz tristanz committed with Nov 9, 2011
Showing with 140 additions and 139 deletions.
  1. +1 −1 lib/parser.js
  2. +8 −7 package.json
  3. +14 −14 test/events.test.js
  4. +4 −4 test/io.test.js
  5. +19 −19 test/node/builder.test.js
  6. +39 −39 test/parser.test.js
  7. +13 −13 test/socket.test.js
  8. +42 −42 test/util.test.js
View
@@ -158,7 +158,7 @@
if (!pieces) return {};
- var id = pieces[2] || ''
+ var id = parseInt(pieces[2]) || ''
, data = pieces[5] || ''
, packet = {
type: packets[pieces[1]]
View
@@ -18,15 +18,16 @@
, "url": "https://github.com/LearnBoost/socket.io-client.git"
}
, "dependencies": {
- "uglify-js": "1.0.6"
- , "websocket-client": "1.0.0"
- , "xmlhttprequest": "1.2.2"
+ "uglify-js": ">=1.0.6"
+ , "websocket-client": ">=1.0.0"
+ , "xmlhttprequest": ">=1.2.2"
}
, "devDependencies": {
- "expresso": "0.7.7"
- , "express": "2.3.11"
- , "jade": "0.12.1"
- , "stylus": "0.13.3"
+ "expresso": ">=0.7.7"
+ , "express": ">=2.3.11"
+ , "jade": ">=0.12.1"
+ , "should": ">=0.0.1"
+ , "stylus": ">=0.13.3"
, "socket.io": "0.8.7"
, "socket.io-client": "0.8.7"
}
View
@@ -15,13 +15,13 @@
event.on('test', function (a, b) {
++calls;
- a.should().eql('a');
- b.should().eql('b');
+ a.should.eql('a');
+ b.should.eql('b');
});
event.emit('test', 'a', 'b');
- calls.should().eql(1);
- event.on.should().eql(event.addListener);
+ calls.should.eql(1);
+ event.on.should.eql(event.addListener);
},
'remove listener': function () {
@@ -32,8 +32,8 @@
event.on('test:more', empty);
event.removeAllListeners('test');
- event.listeners('test').should().eql([]);
- event.listeners('test:more').should().eql([empty]);
+ event.listeners('test').should.eql([]);
+ event.listeners('test:more').should.eql([empty]);
},
'remove all listeners with no arguments': function () {
@@ -45,8 +45,8 @@
event.removeAllListeners();
// TODO: with node 0.5 we'll change this to expect []
- event.listeners('test').should().eql([empty]);
- event.listeners('test:more').should().eql([empty]);
+ event.listeners('test').should.eql([empty]);
+ event.listeners('test:more').should.eql([empty]);
},
'remove listeners functions': function () {
@@ -59,16 +59,16 @@
event.on('one', one);
event.removeListener('one', one);
- event.listeners('one').should().eql([]);
+ event.listeners('one').should.eql([]);
event.on('two', two);
event.removeListener('two', one);
- event.listeners('two').should().eql([two]);
+ event.listeners('two').should.eql([two]);
event.on('three', three);
event.on('three', two);
event.removeListener('three', three);
- event.listeners('three').should().eql([two]);
+ event.listeners('three').should.eql([two]);
},
'number of arguments': function () {
@@ -86,7 +86,7 @@
event.emit('test', null, null, null, null);
event.emit('test', null, null, null, null, null);
- [0, 1, 2, 3, 4, 5].should().eql(number);
+ [0, 1, 2, 3, 4, 5].should.eql(number);
},
'once': function () {
@@ -102,14 +102,14 @@
event.emit('test', 'a', 'b');
function removed () {
- should().fail('not removed');
+ should.fail('not removed');
};
event.once('test:removed', removed);
event.removeListener('test:removed', removed);
event.emit('test:removed');
- calls.should().eql(1);
+ calls.should.eql(1);
}
};
View
@@ -10,16 +10,16 @@
module.exports = {
'client version number': function () {
- io.version.should().match(/([0-9]+)\.([0-9]+)\.([0-9]+)/);
+ io.version.should.match(/([0-9]+)\.([0-9]+)\.([0-9]+)/);
},
'socket.io protocol version': function () {
- io.protocol.should().be.a('number');
- io.protocol.toString().should().match(/^\d+$/);
+ io.protocol.should.be.a('number');
+ io.protocol.toString().should.match(/^\d+$/);
},
'socket.io available transports': function () {
- (io.transports.length > 0).should().be_true;
+ (io.transports.length > 0).should.be_true;
}
};
View
@@ -19,18 +19,18 @@ var builder = require('../../bin/builder')
module.exports = {
'version number': function () {
- builder.version.should().match(/([0-9]+)\.([0-9]+)\.([0-9]+)/);
- builder.version.should().equal(require('../../lib/io').version);
+ builder.version.should.match(/([0-9]+)\.([0-9]+)\.([0-9]+)/);
+ builder.version.should.equal(require('../../lib/io').version);
},
'production build LOC': function () {
builder(function (err, result) {
should.strictEqual(err, null)
var lines = result.split('\n');
- lines.length.should().be.below(5);
- lines[0].should().match(/production/gi);
- Buffer.byteLength(result).should().be.below(43000);
+ lines.length.should.be.below(5);
+ lines[0].should.match(/production/gi);
+ Buffer.byteLength(result).should.be.below(43000);
});
},
@@ -39,9 +39,9 @@ module.exports = {
should.strictEqual(err, null)
var lines = result.split('\n');
- lines.length.should().be.above(5);
- lines[0].should().match(/development/gi);
- Buffer.byteLength(result).should().be.above(35000);
+ lines.length.should.be.above(5);
+ lines[0].should.match(/development/gi);
+ Buffer.byteLength(result).should.be.above(35000);
});
},
@@ -54,10 +54,10 @@ module.exports = {
, defaults = Object.keys(builder.transports);
/* XHR transport is private, but still available */
- transports.length.should().be.equal(defaults.length + 1);
+ transports.length.should.be.equal(defaults.length + 1);
defaults.forEach(function (transport) {
- transports.indexOf(transport).should().be.above(-1);
+ transports.indexOf(transport).should.be.above(-1);
})
});
},
@@ -69,8 +69,8 @@ module.exports = {
var io = common.execute(result).io
, transports = Object.keys(io.Transport);
- transports.should().have.length(1);
- transports[0].should().eql('websocket');
+ transports.should.have.length(1);
+ transports[0].should.eql('websocket');
});
},
@@ -79,7 +79,7 @@ module.exports = {
builder({ custom: [custom], minify: false }, function (err, result) {
should.strictEqual(err, null);
- result.should().include.string(custom);
+ result.should.include.string(custom);
});
},
@@ -90,20 +90,20 @@ module.exports = {
builder({ custom: [custom], minify: false }, function (err, result) {
should.strictEqual(err, null);
- result.should().not.include.string(custom);
- result.should().not.include.string('// if node');
- result.should().not.include.string('// end node');
- result.should().not.include.string('"world"');
+ result.should.not.include.string(custom);
+ result.should.not.include.string('// if node');
+ result.should.not.include.string('// end node');
+ result.should.not.include.string('"world"');
- result.should().include.string('var pew = "pew"');
+ result.should.include.string('var pew = "pew"');
});
},
'preserve the encoding during minification': function () {
builder(function (err, result) {
should.strictEqual(err, null);
- result.should().match(/(\\ufffd)/g);
+ result.should.match(/(\\ufffd)/g);
})
},
Oops, something went wrong.

0 comments on commit 3cbe195

Please sign in to comment.