[READ-ONLY] Mirror of https://github.com/FoxxMD/string-sameness. Compare the sameness of two strings foxxmd.github.io/string-sameness/
compare cosine-similarity dice-coefficient levenshtein-distance sameness string text typescript
0

Configure Feed

Select the types of activity you want to include in your feed.

test: Add unique score sanity test

FoxxMD (Oct 26, 2023, 1:16 PM EDT) a9eae897 e12a662d

+19 -6
+19 -6
tests/index.test.ts
··· 49 49 describe('Strategies', function() { 50 50 51 51 describe('Sanity Checks', function() { 52 - for(const [name, strat] of Object.entries(strategies)) { 53 - it(`${name}: scores identical when strings are identical`, function() { 54 - const res = strat.strategy(sameString, sameString); 55 - assert.equal(100, res.score); 56 - }); 57 - } 52 + 53 + describe('scores identical when strings are identical', function() { 54 + for(const [name, strat] of Object.entries(strategies)) { 55 + it(`${name}: strings are identical`, function() { 56 + const res = strat.strategy(sameString, sameString); 57 + assert.equal(100, res.score); 58 + }); 59 + } 60 + }); 61 + 62 + describe('scores near zero when strings are completely different', function() { 63 + for(const [name, strat] of Object.entries(strategies)) { 64 + it(`${name}: string are completely different`, function() { 65 + const res = strat.strategy(sameString, 'pay bull blood for voice'); 66 + assert.isAtMost(res.score, 10); 67 + }); 68 + } 69 + }); 70 + 58 71 }); 59 72 60 73 });