From 8cd5c884e00cd63e6d4426267394102301a0e9d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Matte?= Date: Tue, 19 Sep 2023 14:20:25 -0400 Subject: [PATCH] Testing sorting boolean values --- lib/sort.test.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/sort.test.js b/lib/sort.test.js index 2289ea9..0388d41 100644 --- a/lib/sort.test.js +++ b/lib/sort.test.js @@ -40,5 +40,16 @@ test('sort by age descending', () => { ]) }) +test('sort by new descending', () => { + const result = data.sort(sortby(['new', 'desc'])) + + + equal(result, [ + { age: 40, name: "Persone 1", new: true }, + { age: 17, name: "Persone 2", new: false }, + ]) +}) + + import { runifmain, summaryreporter, errorreporter } from 'metaltest' await runifmain(import.meta, () => test.run(summaryreporter(), errorreporter())) \ No newline at end of file