Skip to content

Commit

Permalink
test: add test files and fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
jooy2 committed Dec 5, 2024
1 parent b6c2ca5 commit 57b6746
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,4 @@ $RECYCLE.BIN/

# Project files
dist/
test/result/
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
".": "./dist/index.js"
},
"scripts": {
"test": "npm run build && node dist/index.js",
"test": "npm run build && node dist/index.js 'test/src/**/*.js' -o test/result/ --debug",
"build": "npm run format:fix && tsc && npm run minify",
"minify": "terser dist/index.js --config-file .terserrc -o dist/index.js",
"minify": "terser dist/index.js --config-file terser.config.json -o dist/index.js",
"format": "prettier .",
"format:fix": "prettier . --write"
},
Expand Down
3 changes: 0 additions & 3 deletions test/index.js

This file was deleted.

17 changes: 17 additions & 0 deletions test/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
function arrShuffle(array) {
if (array.length === 1) {
return array[0];
}

const newArray = array;

for (let i = array.length - 1; i > 0; i -= 1) {
const j = Math.floor(Math.random() * (i + 1));
[newArray[i], newArray[j]] = [array[j], array[i]];
}

return newArray;
}

export default arrShuffle;
6 changes: 0 additions & 6 deletions test/test.js

This file was deleted.

0 comments on commit 57b6746

Please sign in to comment.