From 9389749b7932c7de95fb16608688864833a46f2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 11 Sep 2020 21:12:49 -0400 Subject: [PATCH] feat: sorted set lex test --- test/database/sorted.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/database/sorted.js b/test/database/sorted.js index 2e0a8d72fa..c63c653433 100644 --- a/test/database/sorted.js +++ b/test/database/sorted.js @@ -1416,6 +1416,15 @@ describe('Sorted Set methods', function () { done(); }); }); + + it('should return correct result', async function () { + await db.sortedSetAdd('sortedSetLexSearch', [0, 0, 0], ['baris:usakli:1', 'baris usakli:2', 'baris soner:3']); + const query = 'baris:'; + const min = query; + const max = query.substr(0, query.length - 1) + String.fromCharCode(query.charCodeAt(query.length - 1) + 1); + const result = await db.getSortedSetRangeByLex('sortedSetLexSearch', min, max, 0, -1); + assert.deepStrictEqual(result, ['baris:usakli:1']); + }); }); describe('getSortedSetRevRangeByLex', function () {