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 24, 2024
1 parent 03a369c commit 50ee1b9
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 @@ -388,6 +388,26 @@ describe('array module', () => {
expect(c.id).toBe('c')
expect(c.word).toBe('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 50ee1b9

Please sign in to comment.