fix: #5570, create per category user post zsets

This commit is contained in:
Barış Soner Uşaklı
2019-06-24 15:21:43 -04:00
parent 4e513cf38a
commit a39f0ef592
15 changed files with 316 additions and 89 deletions

View File

@@ -392,7 +392,7 @@ describe('Sorted Set methods', function () {
describe('sortedSetsCard()', function () {
it('should return the number of elements in sorted sets', function (done) {
db.sortedSetsCard(['sortedSetTest1', 'sortedSetTest2', 'doesnotexist'], function (err, counts) {
assert.equal(err, null);
assert.ifError(err);
assert.equal(arguments.length, 2);
assert.deepEqual(counts, [3, 2, 0]);
done();
@@ -418,6 +418,44 @@ describe('Sorted Set methods', function () {
});
});
describe('sortedSetsCardSum()', function () {
it('should return the total number of elements in sorted sets', function (done) {
db.sortedSetsCardSum(['sortedSetTest1', 'sortedSetTest2', 'doesnotexist'], function (err, sum) {
assert.ifError(err);
assert.equal(arguments.length, 2);
assert.equal(sum, 5);
done();
});
});
it('should return 0 if keys is falsy', function (done) {
db.sortedSetsCardSum(undefined, function (err, counts) {
assert.ifError(err);
assert.equal(arguments.length, 2);
assert.deepEqual(counts, 0);
done();
});
});
it('should return 0 if keys is empty array', function (done) {
db.sortedSetsCardSum([], function (err, counts) {
assert.ifError(err);
assert.equal(arguments.length, 2);
assert.deepEqual(counts, 0);
done();
});
});
it('should return the total number of elements in sorted set', function (done) {
db.sortedSetsCardSum('sortedSetTest1', function (err, sum) {
assert.ifError(err);
assert.equal(arguments.length, 2);
assert.equal(sum, 3);
done();
});
});
});
describe('sortedSetRank()', function () {
it('should return falsy if sorted set does not exist', function (done) {
db.sortedSetRank('doesnotexist', 'value1', function (err, rank) {