mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 17:16:14 +01:00
fix: #5570, create per category user post zsets
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user