Add Jest unit test infrastructure and initial test suite

Sets up Jest + ts-jest for the backend and adds 47 tests across 5
suites covering crypto utilities, OUI vendor lookup, auth middleware,
AlertService dispatch/cooldown logic, and DeviceCollector uptime parsing.
This commit is contained in:
2GT-Rich
2026-04-19 10:21:14 -07:00
parent 6cb2e6844c
commit 5d96503832
8 changed files with 4108 additions and 1 deletions
+6 -1
View File
@@ -8,7 +8,9 @@
"start": "node dist/index.js",
"dev": "nodemon --watch src --ext ts --exec ts-node src/index.ts",
"lint": "eslint src",
"migrate": "ts-node src/db/migrate.ts"
"migrate": "ts-node src/db/migrate.ts",
"test": "jest",
"test:coverage": "jest --coverage"
},
"dependencies": {
"@influxdata/influxdb-client": "^1.33.2",
@@ -35,6 +37,7 @@
"@types/compression": "^1.7.5",
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/jest": "^29.5.14",
"@types/jsonwebtoken": "^9.0.5",
"@types/morgan": "^1.9.9",
"@types/node": "^20.10.5",
@@ -43,7 +46,9 @@
"@types/ssh2": "^1.11.17",
"eslint": "^9.39.4",
"eslint-plugin-security": "^4.0.0",
"jest": "^29.7.0",
"nodemon": "^3.0.2",
"ts-jest": "^29.4.9",
"ts-node": "^10.9.2",
"typescript": "^5.3.3",
"typescript-eslint": "^8.58.2"