smartfuzzy/test/test.objectsorter.ts

20 lines
448 B
TypeScript
Raw Normal View History

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) {}
}
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();