-
Notifications
You must be signed in to change notification settings - Fork 81
Backend Testing [DEV]

GroqTales features a comprehensive test suite specifically designed to ensure the Node.js Express backend and Groq AI service are ready for deployment on Render. Since the backend interacts heavily with external APIs (Groq, Supabase) and requires specific file structures, this test suite validates configurations before any deployment goes live.
To run the backend deployment readiness test, use the following npm command from the root of the project:
npm run test:backendThis will execute the standalone test runner (scripts/backend-test.js).
The test:backend script verifies 50+ critical assertions across 7 different categories:
-
File Structure: Verifies all required backend files exist (
backend.js,worker.js,routes/*.js,render.yaml, etc.). -
Package Configuration: Checks
server/package.jsonfor essential dependencies (express,@supabase/supabase-js,cors, etc.) and start scripts. -
Render Configuration: Analyzes
render.yamlto ensure thegroqtales-backend-apiandgroqtales-workerservices are properly defined, with the required environment variables likeGROQ_API_KEY. -
Groq Service Module: Verifies
groqService.jsstructure:- Ensuring
llama-3.3-70b-versatileand other valid Groq models are configured. - Asserting no deprecated or mock models exist.
- Validating retry logic and error handling fallbacks.
- Ensuring
-
Route Registration: Inspects
backend.jsto confirm that all routes (/api/groq,/api/v1/ai, etc.) and middleware (CORS, rate limiting) are effectively mounted. -
No Placeholder Code: Statically checks route controllers (
ai.js,stories.js) to ensure all legacy placeholder code has been removed and replaced with actualgroqServiceAPI calls. -
Worker Pipeline: Validates
worker.jscontains the required analytics, data cleanup, and content quality check intervals.
Every time the test suite is run, a log report is generated and saved locally in the logs/tests/backend/ directory.
Example log file location:
logs/tests/backend/report-2023-10-31T12-00-00.000Z.log
If even a single test fails, the script exits with an error code (1) to prevent faulty deployments and explicitly saves the breakdown of which assertions failed to the log report.
The test runner is designed to be completely synchronous and filesystem-based, meaning it does not execute the server or require live network connections to pass. This makes it extremely fast and perfect for CI/CD pipelines.
In the future, this command can be linked to your GitHub Actions or Render build scripts to completely block deployments if structural invariants are violated.
GroqTales is an AI-powered Web3 storytelling platform that enables users to create, share, and monetize stories using artificial intelligence and blockchain technology. Join us to revolutionize digital storytelling!
© 2026 GroqTales. @Indie Hub - All rights reserved. Built with ❤️ for storytellers and creators.

Welcome to the GroqTales Wiki! Use the links below to explore our comprehensive documentation.
Navigation designed for GroqTales Wiki users and contributors.