Commit graph

8 commits

Author SHA1 Message Date
Brandon Wolfgang
ca5ca12dba test: reject non-string echo messages
- Verify POST /echo returns HTTP 400 for non-string message values
- Assert invalid request bodies receive the expected generic error response
2026-10-21 19:54:55 -05:00
Brandon Wolfgang
0115190510 fix: sanitize unexpected API error responses
- Add a centralized Fastify error handler with server-side error logging
- Preserve valid 4xx status codes while normalizing other errors to HTTP 500
- Return generic error messages without exposing sensitive internal details
- Add a test endpoint and regression test for unexpected errors
2026-10-21 19:52:54 -05:00
Brandon Wolfgang
c0ca16f166 test: cover echo message length boundaries
- Verify 500-character messages are accepted
- Verify messages exceeding 500 characters are rejected with HTTP 400
- Extract the Zod validation schema to module scope for reuse
2026-10-21 19:36:30 -05:00
Brandon Wolfgang
5546867449 test: add validation tests for POST /echo
- Test successful echo responses for valid messages
- Verify empty messages are rejected with HTTP 400
- Validate request bodies using a Zod schema with a 1–500 character limit
- Return a consistent error response for invalid request bodies
2026-10-21 19:30:31 -05:00
Brandon Wolfgang
21d3da5d20 test: cover unknown API routes 2026-10-21 19:20:57 -05:00
Brandon Wolfgang
ca38e1a30f test: add API endpoint tests with Node.js test runner
- Replace the placeholder test script with tsx --test
- Add tests for GET /health response status and payload
- Add tests for GET /ready response status and dependency status
- Use Fastify injection to test endpoints without opening a network listener
- Close the app after the test suite completes
2026-10-21 19:16:37 -05:00
Brandon Wolfgang
0d09e37af2 refactor: export Fastify app factory for testing
- Extract route and server configuration into an exported buildApp function
- Guard server startup so importing the module does not automatically listen on port 3000
- Preserve health and readiness endpoints and loopback-only binding
- Normalize string literals to double quotes
2026-10-21 17:06:21 -05:00
Brandon Wolfgang
ed9259d35e Initialize local AI platform project 2026-10-21 16:57:52 -05:00