Skip to content

Commit

Permalink
Tests on all your local .bel files
Browse files Browse the repository at this point in the history
  • Loading branch information
mjal committed Jul 9, 2024
1 parent 9f2ef31 commit fc81cda
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
public/*.bel
public/tmp/
tests/*.bel
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"build": "vite build",
"preview": "vite preview",
"lint": "prettier --write .",
"cli": "ts-node src/cli.ts"
"cli": "ts-node src/cli.ts",
"test": "sh tests/test.sh"
},
"devDependencies": {
"@types/node": "^20.14.2",
Expand Down
19 changes: 19 additions & 0 deletions tests/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

check_errors() {
local f="$1"
local output

output=$(ts-node src/cli.ts election verify $f)

if echo "$output" | grep -q "0 errors found."; then
echo "PASS: $f"
else
echo "FAIL: $f"
fi
}

# Loop through each .bel files in tests and check for errors
for f in tests/*.bel; do
check_errors "$f"
done

0 comments on commit fc81cda

Please sign in to comment.