Skip to content

Commit

Permalink
add unit testing
Browse files Browse the repository at this point in the history
  • Loading branch information
kiprobinson committed Jan 10, 2022
1 parent 8d3cf17 commit b1eaaa3
Show file tree
Hide file tree
Showing 4 changed files with 516 additions and 4 deletions.
6 changes: 3 additions & 3 deletions app/lib/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ export const arrayUnion = <T>(a:T[], b:T[]):T[] => {
* Returns the intersection of two arrays.
*/
export const arrayIntersection = <T>(a:T[], b:T[]):T[] => {
const aSet = new Set<T>([...a]);
const bSet = new Set<T>([...b]);
const res = new Set<T>();
for(let el of b) {
if(aSet.has(el)) {
for(let el of a) {
if(bSet.has(el)) {
res.add(el);
}
}
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "index.ts",
"scripts": {
"start": "ts-node index.ts",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "mocha -r ts-node/register ./test/**/*.spec.ts"
},
"repository": {
"type": "git",
Expand All @@ -18,8 +18,12 @@
},
"homepage": "https://github.com/kiprobinson/wordle-solver#readme",
"devDependencies": {
"@types/chai": "^4.3.0",
"@types/mocha": "^9.0.0",
"@types/node": "^17.0.8",
"chai": "^4.3.4",
"eslint": "^8.6.0",
"mocha": "^9.1.3",
"ts-node": "^10.4.0",
"typescript": "^4.5.4"
}
Expand Down
Loading

0 comments on commit b1eaaa3

Please sign in to comment.