|
|
|
@ -1823,7 +1823,9 @@ describe('User', function () {
|
|
|
|
|
|
|
|
|
|
describe('.add()', function () {
|
|
|
|
|
it('should block a uid', function (done) {
|
|
|
|
|
User.blocks.add(blockeeUid, 1, function (err, blocked_uids) {
|
|
|
|
|
User.blocks.add(blockeeUid, 1, function (err) {
|
|
|
|
|
assert.ifError(err);
|
|
|
|
|
User.blocks.list(1, function (err, blocked_uids) {
|
|
|
|
|
assert.ifError(err);
|
|
|
|
|
assert.strictEqual(Array.isArray(blocked_uids), true);
|
|
|
|
|
assert.strictEqual(blocked_uids.length, 1);
|
|
|
|
@ -1831,6 +1833,7 @@ describe('User', function () {
|
|
|
|
|
done();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should automatically increment corresponding user field', function (done) {
|
|
|
|
|
db.getObjectField('user:1', 'blocksCount', function (err, count) {
|
|
|
|
@ -1850,13 +1853,16 @@ describe('User', function () {
|
|
|
|
|
|
|
|
|
|
describe('.remove()', function () {
|
|
|
|
|
it('should unblock a uid', function (done) {
|
|
|
|
|
User.blocks.remove(blockeeUid, 1, function (err, blocked_uids) {
|
|
|
|
|
User.blocks.remove(blockeeUid, 1, function (err) {
|
|
|
|
|
assert.ifError(err);
|
|
|
|
|
User.blocks.list(1, function (err, blocked_uids) {
|
|
|
|
|
assert.ifError(err);
|
|
|
|
|
assert.strictEqual(Array.isArray(blocked_uids), true);
|
|
|
|
|
assert.strictEqual(blocked_uids.length, 0);
|
|
|
|
|
done();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should automatically decrement corresponding user field', function (done) {
|
|
|
|
|
db.getObjectField('user:1', 'blocksCount', function (err, count) {
|
|
|
|
|