fix: broken test after sorted-lists logic change

v1.18.x
Julian Lam 4 years ago
parent d5d24594e8
commit d6f60f4502

@ -58,10 +58,9 @@ Settings.set = async function (hash, values, quiet) {
const sortedLists = Object.keys(sortedListData);
if (sortedLists.length) {
await db.setAdd('settings:' + hash + ':sorted-lists', sortedLists);
// Remove provided (but empty) sorted lists from the hash set
await db.setRemove('settings:' + hash + ':sorted-lists', sortedLists.filter(list => !sortedListData[list].length));
await db.setAdd('settings:' + hash + ':sorted-lists', sortedLists);
await Promise.all(sortedLists.map(async function (list) {
const numItems = await db.sortedSetCard('settings:' + hash + ':sorted-list:' + list);

@ -128,10 +128,10 @@ describe('meta', function () {
it('should get setting with sorted list', function (done) {
socketAdmin.settings.get({ uid: fooUid }, { hash: 'another:hash' }, function (err, data) {
assert.ifError(err);
assert.equal(data.foo, '1');
assert.equal(data.derp, 'value');
assert.deepEqual(data.someList, someList);
assert.deepEqual(data.anotherList, anotherList);
assert.strictEqual(data.foo, '1');
assert.strictEqual(data.derp, 'value');
assert.deepStrictEqual(data.someList, someList);
assert.deepStrictEqual(data.anotherList, anotherList);
done();
});
});

Loading…
Cancel
Save