mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: broken test after sorted-lists logic change
This commit is contained in:
@@ -58,10 +58,9 @@ Settings.set = async function (hash, values, quiet) {
|
|||||||
const sortedLists = Object.keys(sortedListData);
|
const sortedLists = Object.keys(sortedListData);
|
||||||
|
|
||||||
if (sortedLists.length) {
|
if (sortedLists.length) {
|
||||||
await db.setAdd('settings:' + hash + ':sorted-lists', sortedLists);
|
|
||||||
|
|
||||||
// Remove provided (but empty) sorted lists from the hash set
|
// 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.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) {
|
await Promise.all(sortedLists.map(async function (list) {
|
||||||
const numItems = await db.sortedSetCard('settings:' + hash + ':sorted-list:' + 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) {
|
it('should get setting with sorted list', function (done) {
|
||||||
socketAdmin.settings.get({ uid: fooUid }, { hash: 'another:hash' }, function (err, data) {
|
socketAdmin.settings.get({ uid: fooUid }, { hash: 'another:hash' }, function (err, data) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.equal(data.foo, '1');
|
assert.strictEqual(data.foo, '1');
|
||||||
assert.equal(data.derp, 'value');
|
assert.strictEqual(data.derp, 'value');
|
||||||
assert.deepEqual(data.someList, someList);
|
assert.deepStrictEqual(data.someList, someList);
|
||||||
assert.deepEqual(data.anotherList, anotherList);
|
assert.deepStrictEqual(data.anotherList, anotherList);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user