fix(detector): Improve test coverage and adjust detection result handling

This commit is contained in:
2025-05-26 09:48:42 +00:00
parent a39edf4c56
commit 851e12f499
6 changed files with 165 additions and 20 deletions

View File

@@ -37,11 +37,17 @@
- **v2.0.2**: Added service type detection, protocol fingerprinting, and enhanced API
## Testing
- Tests check for closed local ports and open remote ports
- Tests verify service type detection for HTTP/HTTPS
- Tests check SSH service detection
- Comprehensive test suite with 19 tests covering:
- Basic port detection (local and remote)
- Backward compatibility with `isActiveSimple()`
- Service type detection for HTTP, HTTPS, SSH
- Error handling and edge cases
- Performance benchmarks
- Common development ports
- Database service detection (MySQL, Redis)
- Uses `@git.zone/tstest` with tap-style testing
- Example tests: localhost:3008 (expects closed), lossless.com (expects open)
- Tests ensure serviceType is always returned when detectServiceType option is true
- Handles non-standard URL schemes with default ports
## Notes
- Project uses pnpm for package management