Summary
Cover the missing integration tests for /api/analytics endpoints: /apy-history, /user-yield, and /protocol-performance.
What to do
- Create tests/integration/api/analytics.test.ts (or separate files) to test:
- Auth behavior for protected endpoints (401 without token).
- Successful responses with seeded DB data for a user.
- Validation error responses for invalid period query values.
- protocol-performance public endpoint returns grouped protocols structure.
- Use test factories to seed yieldSnapshot, position, and protocolRate data.
- Clean up DB after tests.
Acceptance criteria
- Tests added and passing in CI.
- Coverage includes success and failure cases for each endpoint.
Labels: tests, integration
Summary
Cover the missing integration tests for /api/analytics endpoints: /apy-history, /user-yield, and /protocol-performance.
What to do
Acceptance criteria
Labels: tests, integration