smartfuzzy/test/test.objectsorter.ts

22 lines
488 B
TypeScript
Raw Normal View History

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