feat: #7707, added sortedSetAddBulk

This commit is contained in:
Barış Soner Uşaklı
2019-06-24 17:48:13 -04:00
parent e48c7cd717
commit 3ecd703ea3
5 changed files with 106 additions and 35 deletions

View File

@@ -120,6 +120,34 @@ describe('Sorted Set methods', function () {
});
});
describe('sortedSetAddMulti()', function () {
it('should add elements into multiple sorted sets with different scores', function (done) {
db.sortedSetAddBulk([
['bulk1', 1, 'item1'],
['bulk2', 2, 'item1'],
['bulk2', 3, 'item2'],
['bulk3', 4, 'item3'],
], function (err) {
assert.ifError(err);
assert.equal(arguments.length, 1);
db.getSortedSetRevRangeWithScores(['bulk1', 'bulk2', 'bulk3'], 0, -1, function (err, data) {
assert.ifError(err);
assert.deepStrictEqual(data, [{ value: 'item3', score: 4 },
{ value: 'item2', score: 3 },
{ value: 'item1', score: 2 },
{ value: 'item1', score: 1 }]);
done();
});
});
});
it('should not error if data is undefined', function (done) {
db.sortedSetAddBulk(undefined, function (err) {
assert.ifError(err);
done();
});
});
});
describe('getSortedSetRange()', function () {
it('should return the lowest scored element', function (done) {
db.getSortedSetRange('sortedSetTest1', 0, 0, function (err, value) {