mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
tests: fixed tests for 0.8
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
}
|
||||
, "devDependencies": {
|
||||
"expresso": "0.9.2"
|
||||
, "should": "0.0.4"
|
||||
, "should": "*"
|
||||
, "benchmark": "0.2.2"
|
||||
, "microtime": "0.1.3-1"
|
||||
, "colors": "0.5.1"
|
||||
|
||||
@@ -103,7 +103,11 @@ HTTPClient.prototype.end = function () {
|
||||
Object.keys(this.agent.sockets).forEach(function (socket) {
|
||||
for (var i = 0, l = self.agent.sockets[socket].length; i < l; ++i) {
|
||||
if (self.agent.sockets[socket][i]._handle) {
|
||||
self.agent.sockets[socket][i]._handle.socket.end();
|
||||
if (self.agent.sockets[socket][i]._handle.socket) {
|
||||
self.agent.sockets[socket][i]._handle.socket.end();
|
||||
} else {
|
||||
self.agent.sockets[socket][i]._handle.owner.end();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -95,7 +95,7 @@ module.exports = {
|
||||
'decoding json packet with message id and ack data': function () {
|
||||
parser.decodePacket('4:1+::{"a":"b"}').should.eql({
|
||||
type: 'json'
|
||||
, id: 1
|
||||
, id: '1'
|
||||
, ack: 'data'
|
||||
, endpoint: ''
|
||||
, data: { a: 'b' }
|
||||
@@ -114,7 +114,7 @@ module.exports = {
|
||||
'decoding an event packet with message id and ack': function () {
|
||||
parser.decodePacket('5:1+::{"name":"tobi"}').should.eql({
|
||||
type: 'event'
|
||||
, id: 1
|
||||
, id: '1'
|
||||
, ack: 'data'
|
||||
, endpoint: ''
|
||||
, name: 'tobi'
|
||||
@@ -143,7 +143,7 @@ module.exports = {
|
||||
'decoding a message packet with id and endpoint': function () {
|
||||
parser.decodePacket('3:5:/tobi').should.eql({
|
||||
type: 'message'
|
||||
, id: 5
|
||||
, id: '5'
|
||||
, ack: true
|
||||
, endpoint: '/tobi'
|
||||
, data: ''
|
||||
@@ -245,7 +245,7 @@ module.exports = {
|
||||
'encoding json packet with message id and ack data': function () {
|
||||
parser.encodePacket({
|
||||
type: 'json'
|
||||
, id: 1
|
||||
, id: '1'
|
||||
, ack: 'data'
|
||||
, endpoint: ''
|
||||
, data: { a: 'b' }
|
||||
@@ -264,7 +264,7 @@ module.exports = {
|
||||
'encoding an event packet with message id and ack': function () {
|
||||
parser.encodePacket({
|
||||
type: 'event'
|
||||
, id: 1
|
||||
, id: '1'
|
||||
, ack: 'data'
|
||||
, endpoint: ''
|
||||
, name: 'tobi'
|
||||
@@ -292,7 +292,7 @@ module.exports = {
|
||||
'encoding a message packet with id and endpoint': function () {
|
||||
parser.encodePacket({
|
||||
type: 'message'
|
||||
, id: 5
|
||||
, id: '5'
|
||||
, ack: true
|
||||
, endpoint: '/tobi'
|
||||
, data: ''
|
||||
|
||||
@@ -452,7 +452,7 @@ module.exports = {
|
||||
|
||||
cl.get('/socket.io/socket.io.js', function (res, data) {
|
||||
res.headers['content-type'].should.eql('application/javascript');
|
||||
res.headers['content-length'].should.eql(13);
|
||||
res.headers['content-length'].should.eql('13');
|
||||
res.headers.etag.should.eql('1.0');
|
||||
|
||||
data.should.eql('custom_client');
|
||||
|
||||
@@ -104,7 +104,7 @@ module.exports = {
|
||||
netConnection(port, function (err, data){
|
||||
should.strictEqual(err, null);
|
||||
|
||||
data.toString().should.include.string('<cross-domain-policy>');
|
||||
data.toString().should.match(/<cross-domain-policy>/);
|
||||
|
||||
this.destroy();
|
||||
io.flashPolicyServer.close();
|
||||
@@ -133,7 +133,7 @@ module.exports = {
|
||||
netConnection(next, function (err, data){
|
||||
should.strictEqual(err, null);
|
||||
|
||||
data.toString().should.include.string('<cross-domain-policy>');
|
||||
data.toString().should.match(/<cross-domain-policy>/);
|
||||
|
||||
this.destroy();
|
||||
io.flashPolicyServer.close();
|
||||
@@ -159,7 +159,7 @@ module.exports = {
|
||||
server.origins.should.not.contain('google.com:80');
|
||||
server.origins.should.contain('foo.bar:80');
|
||||
server.origins.should.contain('socket.io:1337');
|
||||
server.buffer.toString('utf8').should.include.string('socket.io');
|
||||
server.buffer.toString('utf8').should.match(/socket\.io/);
|
||||
|
||||
io.flashPolicyServer.close();
|
||||
done();
|
||||
|
||||
@@ -257,7 +257,7 @@ module.exports = {
|
||||
, sid;
|
||||
|
||||
io.configure(function () {
|
||||
io.set('close timeout', .05);
|
||||
io.set('close timeout', .1);
|
||||
});
|
||||
|
||||
io.sockets.on('connection', function (socket) {
|
||||
@@ -625,7 +625,7 @@ module.exports = {
|
||||
|
||||
io.configure(function () {
|
||||
io.set('polling duration', .2);
|
||||
io.set('close timeout', .2);
|
||||
io.set('close timeout', .5);
|
||||
});
|
||||
|
||||
io.sockets.on('connection', function (socket) {
|
||||
|
||||
@@ -1351,7 +1351,7 @@ module.exports = {
|
||||
msgs.should.have.length(1);
|
||||
msgs[0].should.eql({
|
||||
type: 'ack'
|
||||
, ackId: 1
|
||||
, ackId: '1'
|
||||
, endpoint: ''
|
||||
, args: []
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user