diff --git a/test/user.js b/test/user.js index 1cdcce717b..9eae6f7f09 100644 --- a/test/user.js +++ b/test/user.js @@ -798,6 +798,35 @@ describe('User', function () { }); }); }); + + it('should ban user permanently', function (done) { + User.ban(testUid, function (err) { + assert.ifError(err); + User.isBanned(testUid, function (err, isBanned) { + assert.ifError(err); + assert.equal(isBanned, true); + User.unban(testUid, done); + }); + }); + }); + + it('should ban user temporarily', function (done) { + User.ban(testUid, Date.now() + 2000, function (err) { + assert.ifError(err); + + User.isBanned(testUid, function (err, isBanned) { + assert.ifError(err); + assert.equal(isBanned, true); + setTimeout(function () { + User.isBanned(testUid, function (err, isBanned) { + assert.ifError(err); + assert.equal(isBanned, false); + User.unban(testUid, done); + }); + }, 3000); + }); + }); + }); }); describe('digests', function () {