Testing and Diagnostics
Relevant source files - app.js - controllers/test.controller.js - public/index.html - public/test.html - routes/test.routes.js - test-email.js
The Subscription Tracker API includes a suite of diagnostic tools and manual testing interfaces designed to verify system health, validate email delivery pipelines, and provide a low-friction environment for API exploration. These tools allow developers to bypass complex scheduling logic to ensure the underlying infrastructure is functioning correctly.
Health Monitoring
The system provides a basic health check endpoint at /api/v1/healthapp.js44-51 This endpoint returns JSON data containing the service status, process uptime, and the current environment configuration. It is frequently used by monitoring services to ensure the Express server is responsive.
System Health Components
| Component | Endpoint / File | Purpose |
|---|---|---|
| Health Check | GET /api/v1/health |
Verifies server responsiveness and environment app.js44-51 |
| Index Page | GET / |
Provides a visual health dashboard and links public/index.html1-240 |
| Transporter Check | verifyTransporter() |
Validates SMTP connection to Brevo controllers/test.controller.js29-36 |
Browser-Based API Tester
The project includes a custom-built, browser-based testing interface located at public/test.htmlpublic/test.html1-91 This tool facilitates rapid prototyping and manual verification of the authentication and subscription lifecycles without requiring external tools like Postman.
It features a split-pane layout where the left side contains input forms for Sign-Up, Sign-In, and Subscription creation, while the right side serves as a real-time terminal log displaying raw API responses. The tester automatically manages Bearer tokens after a successful login, enabling subsequent authorized requests.
For details, see Browser-Based API Tester.
Email and Workflow Diagnostics
Because the production workflow involves asynchronous delays (sleeping for days until a reminder is due), the system provides diagnostic routes and scripts to trigger immediate actions.
- Test Route: The
POST /api/v1/test/send-reminder-emailendpoint routes/test.routes.js51 allows an authenticated user to trigger a "1-day reminder" email immediately for a specificsubscriptionId. - Test Script: A standalone script,
test-email.jstest-email.js1-40 can be executed from the command line to verify SMTP credentials and network connectivity to the Brevo mail servers.
For details, see Test Controller and Email Diagnostics.
Diagnostic Flow and Code Mapping
The following diagram illustrates how the diagnostic tools interact with the core application logic and external services.
Diagnostic Pipeline Architecture
[Flowchart Diagram]
Sources:
- app.js44-51
- routes/test.routes.js51
- controllers/test.controller.js5-49
- test-email.js1-40
- public/test.html87-175
Code Entity Association
This diagram maps the natural language testing requirements to the specific code entities responsible for executing them.
Testing Requirements to Code Entities
[Flowchart Diagram]
Sources: