SnapAPI/package.json
OpenClawd cda259a3c6
Some checks failed
Build & Deploy to Staging / Build & Deploy to Staging (push) Has been cancelled
Add comprehensive test framework with vitest and TDD tests
- Set up vitest test framework with proper configuration
- Added test scripts to package.json (test, test:watch, test:ui)
- Created comprehensive SSRF validation tests (30 tests)
  - Tests for protocol validation (HTTP/HTTPS only)
  - Private IP blocking (127.x, 10.x, 172.16-31.x, 192.168.x, 169.254.x)
  - Kubernetes service DNS blocking (.svc, .cluster.local, etc.)
  - URL length validation (max 2048 chars)
  - DNS resolution error handling
  - Edge cases with ports, query params, userinfo
- Created cache service tests (19 tests)
  - Cache hit/miss operations
  - Deterministic key generation
  - TTL expiry behavior
  - Size limits and LRU eviction
  - Cache bypass logic
  - Statistics tracking
- Created integration test suite (marked as skip for CI)
  - Health endpoint tests
  - Playground endpoint tests with rate limiting
  - Authentication tests for screenshot endpoints
  - CORS header validation
  - Error handling and security headers
- All unit tests pass (49 total tests)
- Following strict Red/Green TDD methodology
2026-02-24 16:23:06 +00:00

40 lines
1,009 B
JSON

{
"name": "snapapi",
"version": "0.1.0",
"description": "URL to Screenshot API — PNG, JPEG, WebP via simple REST API",
"main": "dist/index.js",
"type": "module",
"scripts": {
"build": "tsc",
"start": "node dist/index.js",
"dev": "tsx src/index.ts",
"test": "vitest run",
"test:watch": "vitest",
"test:ui": "vitest --ui"
},
"dependencies": {
"compression": "^1.8.1",
"express": "^4.21.0",
"express-rate-limit": "^7.5.0",
"helmet": "^8.0.0",
"nanoid": "^5.0.0",
"pg": "^8.13.0",
"pino": "^10.3.1",
"puppeteer": "^24.0.0",
"stripe": "^17.0.0",
"swagger-jsdoc": "^6.2.8"
},
"devDependencies": {
"@types/compression": "^1.8.1",
"@types/express": "^5.0.0",
"@types/node": "^22.0.0",
"@types/pg": "^8.0.0",
"@types/supertest": "^6.0.3",
"@types/swagger-jsdoc": "^6.0.4",
"@vitest/ui": "^4.0.18",
"supertest": "^7.2.2",
"tsx": "^4.0.0",
"typescript": "^5.6.0",
"vitest": "^4.0.18"
}
}