From 072e392854bf404331c121e8cfbee543dcf9b5bd Mon Sep 17 00:00:00 2001 From: Roman Dvornov Date: Sun, 29 Oct 2023 00:56:24 +0200 Subject: [PATCH] Fix test for old nodejs --- test/suggestions.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/suggestions.js b/test/suggestions.js index 6768d8f..bb6855e 100644 --- a/test/suggestions.js +++ b/test/suggestions.js @@ -89,8 +89,9 @@ function describeCasesWithOptions(title, options, cases) { (queryString[0] === '!' ? it.skip : it)(queryString + ' // limit & sort', () => { assert.deepEqual( suggestQuery(queryString, data, options, true), - expected.slice().map(s => - s && s.slice().sort((a, b) => a.type !== b.type + expected.slice().map(variants => + // use methods.sort() since it provides stable sorting for old engines + variants && query.methods.sort(variants, (a, b) => a.type !== b.type ? 0 : a.type === 'value' ? query.buildin.cmp(JSON.parse(a.value), JSON.parse(b.value))