Created
August 30, 2012 16:27
-
-
Save ritalin/3532387 to your computer and use it in GitHub Desktop.
An Unit test for the client side socket.io, by mocha
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Test by mocha | |
// | |
XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; | |
var cli = require('../client/js/socket.io'); // Socket.io client module | |
var should = require('should'); | |
// The global.location is necessary | |
var page = "http://127.0.0.1:8888/hello.html"; | |
global.location = require('url').parse(page); | |
describe("Test on the client side", function() { | |
var server; | |
describe("Connect the server with Socket.IO", function() { | |
it ("Should establish connection", function() { | |
var client = cli.connect(page); | |
client.should.be.ok; | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment