socket/meta test

This commit is contained in:
barisusakli
2016-11-18 15:32:35 +03:00
parent 853cea7fec
commit e3616ab0f9
2 changed files with 50 additions and 3 deletions

View File

@@ -275,6 +275,53 @@ describe('socket.io', function () {
});
});
it('should push unread notifications on reconnect', function (done) {
var socketMeta = require('../src/socket.io/meta');
socketMeta.reconnected({uid: 1}, {}, function (err) {
assert.ifError(err);
done();
});
});
it('should error if the room is missing', function (done) {
io.emit('meta.rooms.enter', null, function (err) {
assert.equal(err.message, '[[error:invalid-data]]');
done();
});
});
it('should return if uid is 0', function (done) {
var socketMeta = require('../src/socket.io/meta');
socketMeta.rooms.enter({uid: 0}, null, function (err) {
assert.ifError(err);
done();
});
});
it('should join a room', function (done) {
io.emit('meta.rooms.enter', {enter: 'recent_topics'}, function (err) {
assert.ifError(err);
done();
});
});
it('should leave current room', function (done) {
io.emit('meta.rooms.leaveCurrent', {}, function (err) {
assert.ifError(err);
done();
});
});
it('should get server time', function (done) {
var socketMeta = require('../src/socket.io/meta');
socketMeta.getServerTime({uid: 1}, null, function (err, time) {
assert.ifError(err);
assert(time);
done();
});
});
after(function (done) {
db.emptydb(done);
});