Skip to content

Commit

Permalink
test: add a test
Browse files Browse the repository at this point in the history
Thanks to @jordydhoker for contributing this test: sodiray/radash#343
  • Loading branch information
aleclarson committed Jun 23, 2024
1 parent fd50966 commit 3ee06c5
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/tests/array.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,26 @@ describe('array module', () => {
assert.equal(c.id, 'c')
assert.equal(c.word, 'yolo')
})
test('correctly handles non string, number or symbol values', () => {
const list: any[] = [
null,
null,
true,
true,
'true',
false,
{ id: 'a', word: 'hello' },
{ id: 'a', word: 'hello' }
]
const result = _.unique(list, val => (val && val.id) ?? val)
assert.deepEqual(result, [
null,
true,
'true',
false,
{ id: 'a', word: 'hello' }
])
})
})

describe('range function', () => {
Expand Down

0 comments on commit 3ee06c5

Please sign in to comment.