smartfuzzy/test/test.smartfuzzy.ts

27 lines
705 B
TypeScript

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