Testing sorting boolean values

master
Frédéric Matte 2023-09-19 14:20:25 -04:00
parent 99abda4ac1
commit 8cd5c884e0
1 changed files with 11 additions and 0 deletions

View File

@ -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' import { runifmain, summaryreporter, errorreporter } from 'metaltest'
await runifmain(import.meta, () => test.run(summaryreporter(), errorreporter())) await runifmain(import.meta, () => test.run(summaryreporter(), errorreporter()))