Add comprehensive geofence testing scripts

Added three test scripts for validating geofence functionality:

1. test-geofence.js: Database-level geofence testing
   - Creates test geofence and mock locations
   - Tests distance calculations and event generation
   - Validates state tracking (enter/exit detection)

2. test-geofence-notification.js: Email notification testing
   - Tests SMTP connection and email delivery
   - Sends formatted geofence notification email
   - Validates email template rendering

3. test-mqtt-geofence.js: Full MQTT integration testing
   - Publishes OwnTracks-formatted MQTT messages
   - Tests complete flow: MQTT → Geofence → Email
   - Simulates device entering/exiting zones

**NPM Scripts:**
- npm run test:geofence - Database and logic test
- npm run test:geofence:email - Email notification test
- npm run test:geofence:mqtt - Full MQTT integration test

**Other Changes:**
- Updated admin user email to joachim.hummel@gmail.com
- All scripts include cleanup instructions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-02 18:32:06 +00:00
parent bd6a7ab187
commit b4bd967400
5 changed files with 911 additions and 0 deletions

View File

@@ -16,6 +16,9 @@
"db:cleanup:7d": "node scripts/cleanup-old-locations.js 168",
"db:cleanup:30d": "node scripts/cleanup-old-locations.js 720",
"test:location": "node scripts/add-test-location.js",
"test:geofence": "node scripts/test-geofence.js",
"test:geofence:email": "node scripts/test-geofence-notification.js",
"test:geofence:mqtt": "node scripts/test-mqtt-geofence.js",
"email:dev": "email dev"
},
"keywords": [],