Open
Description
We need to add comprehensive API tests to ensure stability and prevent regressions. Please refer to existing test patterns in events.test.ts and recently added cases in linkry.test.ts.
Focus: API endpoints only – no UI or integration tests at this stage.
Mention and Cover Unhappy and Happy Paths for each scenario and match the response code.
Test Scenarios to Cover
- Get Links:
- Happy path: Successful retrieval of links
- Unhappy paths: Unauthorized access, invalid user, empty result set
Edit Link:
- Valid update
- Invalid or missing link ID/Slug
- Invalid request body
- Unauthorized access
- Verify all success and error response messages
Delete Link:
- Successful deletion
- Link not found or invalid ID
- Unauthorized attempt
Get Link Data:
- Valid retrieval
- Nonexistent or malformed ID
Get Link by Slug:
- Happy path: Valid slug
- Slug not found or invalid
Get Admin Links:
- Admin access validation
- Unauthorized or non-admin access
Notes
- Verify the response structure, messages, and status codes
- Refactor unclear or misleading response messages where needed
- Include edge cases for each scenario