smartfuzzy/test/test.smartfuzzy.ts

27 lines
705 B
TypeScript
Raw Normal View History

import { expect, tap } from '@push.rocks/tapbundle';
import * as smartfuzzy from '../ts/index.js';
2018-08-19 15:17:59 +02:00
let testSmartfuzzy: smartfuzzy.Smartfuzzy;
tap.test('should create an instance of Smartfuzzy', async () => {
testSmartfuzzy = new smartfuzzy.Smartfuzzy([
'Sony',
'Deutsche Bahn',
'Apple Inc.',
2021-10-03 17:37:03 +02:00
"Trader Joe's",
2018-08-19 15:17:59 +02:00
]);
expect(testSmartfuzzy).toBeInstanceOf(smartfuzzy.Smartfuzzy);
2018-08-19 15:17:59 +02:00
});
tap.test('should compute a score', async () => {
const result = testSmartfuzzy.getChangeScoreForString('Apple');
console.log(result);
2018-08-19 15:17:59 +02:00
});
tap.test('should get closest match', async () => {
const result = testSmartfuzzy.getClosestMatchForString('Apple');
console.log(result);
});
2018-08-19 15:17:59 +02:00
tap.start();