mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-11 00:08:30 +01:00
20 lines
554 B
TypeScript
20 lines
554 B
TypeScript
import { uniqueByKey } from './unique';
|
|
|
|
test('should filter unique objects by key', () => {
|
|
expect(
|
|
uniqueByKey(
|
|
[
|
|
{ name: 'name1', value: 'val1' },
|
|
{ name: 'name1', value: 'val1' },
|
|
{ name: 'name1', value: 'val2' },
|
|
{ name: 'name1', value: 'val4' },
|
|
{ name: 'name2', value: 'val5' },
|
|
],
|
|
'name',
|
|
),
|
|
).toStrictEqual([
|
|
{ name: 'name1', value: 'val4' },
|
|
{ name: 'name2', value: 'val5' },
|
|
]);
|
|
});
|