2025-05-12 13:37:34 +00:00
|
|
|
import { expect, tap } from '@push.rocks/tapbundle';
|
|
|
|
import * as smartfuzzy from '../ts/index.js';
|
2021-10-03 17:12:02 +02:00
|
|
|
|
|
|
|
tap.test('should sort objects', async () => {
|
|
|
|
class Car {
|
|
|
|
constructor(public brand: string) {}
|
|
|
|
}
|
|
|
|
|
2025-05-12 13:37:34 +00:00
|
|
|
const testObjectSorter = new smartfuzzy.ObjectSorter<Car>([
|
2021-10-03 17:12:02 +02:00
|
|
|
new Car('BMW'),
|
|
|
|
new Car('Mercedes Benz'),
|
2021-10-03 17:37:03 +02:00
|
|
|
new Car('Volvo'),
|
2021-10-03 17:12:02 +02:00
|
|
|
]);
|
|
|
|
|
|
|
|
const result = testObjectSorter.sort('Volvo', ['brand']);
|
|
|
|
console.log(result);
|
|
|
|
});
|
|
|
|
|
|
|
|
tap.start();
|