Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8e08a6d

Browse files
committed
Merge pull request socketio#1562 from rase-/add/utf8-tests
Add test case for emitting multibyte chars
2 parents 2c1b611 + 318ae87 commit 8e08a6d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/socket.io.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,28 @@ describe('socket.io', function(){
446446
});
447447
});
448448

449+
it('should emit events with utf8 multibyte character', function(done) {
450+
var srv = http();
451+
var sio = io(srv);
452+
srv.listen(function(){
453+
var socket = client(srv);
454+
var i = 0;
455+
socket.on('hoot', function(a){
456+
expect(a).to.be('utf8 — string');
457+
i++;
458+
459+
if (3 == i) {
460+
done();
461+
}
462+
});
463+
sio.on('connection', function(s){
464+
s.emit('hoot', 'utf8 — string');
465+
s.emit('hoot', 'utf8 — string');
466+
s.emit('hoot', 'utf8 — string');
467+
});
468+
});
469+
});
470+
449471
it('should emit events with binary data', function(done){
450472
var srv = http();
451473
var sio = io(srv);

0 commit comments

Comments
 (0)