-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Alessandro Sanino <[email protected]>
- Loading branch information
Showing
8 changed files
with
51,533 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
testdata/* | ||
*.test.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { describe, it } from "mocha"; | ||
import small_test from "./testdata/small_test"; | ||
import big_test from "./testdata/big_test"; | ||
import { expect } from "chai"; | ||
import gestaltSimilarity from "."; | ||
|
||
describe("Library Tests (Average string length = 18 characters)", () => { | ||
it(`Short Test (${small_test.length} elements)`, () => { | ||
test_from_cases(small_test); | ||
}) | ||
it(`Big Test (${big_test.length} elements)`, () => { | ||
test_from_cases(big_test); | ||
}) | ||
}); | ||
|
||
type TestCase = { | ||
first: string; | ||
second: string; | ||
expected_result: number; | ||
} | ||
|
||
function test_from_cases(cases : TestCase[]) { | ||
for (const { first, second, expected_result } of cases) { | ||
const actual_result = gestaltSimilarity(first, second); | ||
expect(actual_result).to.be.equal(expected_result, `gestaltSimilarity("${first}", "${second}") did not pass the test`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{ | ||
"name": "gestalt-pattern-matcher", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "[email protected]:saniales/gestalt-pattern-matcher.git" | ||
|
@@ -15,14 +16,27 @@ | |
"url": "https://alessandro.sanino.dev" | ||
}, | ||
"description": "Finds the similarity between strings and represents it as a number", | ||
"keywords": [ "pattern-matching", "gestalt", "string-similarity", "similarity" ], | ||
"license": "MIT", | ||
"keywords": [ | ||
"pattern-matching", | ||
"gestalt", | ||
"string-similarity", | ||
"similarity" | ||
], | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"test": "mocha -r ts-node/register '*.test.ts'", | ||
"prepublish": "tsc" | ||
}, | ||
"devDependencies": { | ||
"@types/chai": "^4.2.12", | ||
"@types/mocha": "^8.0.3", | ||
"chai": "^4.2.0", | ||
"mocha": "^8.1.3", | ||
"ts-node": "^9.0.0", | ||
"typescript": "^4.0.3" | ||
}, | ||
"dependencies": { | ||
"faker": "^5.1.0" | ||
} | ||
} |
Oops, something went wrong.