more unit testing
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Failing after 1m13s
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Failing after 1m13s
This commit is contained in:
@@ -87,45 +87,30 @@ jobs:
|
|||||||
run: npm run lint # Run the linter to check for code quality issues.
|
run: npm run lint # Run the linter to check for code quality issues.
|
||||||
continue-on-error: true # Allows the workflow to proceed even if linting fails.
|
continue-on-error: true # Allows the workflow to proceed even if linting fails.
|
||||||
|
|
||||||
- name: Run Unit Tests
|
- name: Run All Tests and Generate Merged Coverage Report
|
||||||
# We override the production DB variables for this step only.
|
# This single step runs both unit and integration tests, then merges their
|
||||||
# The 'global-setup.ts' will use these to connect to the test database,
|
# coverage data into a single report. It combines the environment variables
|
||||||
# create the schema, and seed data before tests run.
|
# needed for both test suites.
|
||||||
env:
|
|
||||||
DB_HOST: ${{ secrets.DB_HOST }}
|
|
||||||
DB_PORT: ${{ secrets.DB_PORT }}
|
|
||||||
DB_USER: ${{ secrets.DB_USER }}
|
|
||||||
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
|
|
||||||
DB_DATABASE: "flyer-crawler-test" # Hardcode the test database name
|
|
||||||
DB_NAME: "flyer-crawler-test" # REQUIRED: Used by connection.ts to match the test setup
|
|
||||||
run: npm test # Run the test suite against the temporary test database.
|
|
||||||
# also Run the test suite to ensure code correctness.
|
|
||||||
|
|
||||||
- name: Run Integration Tests
|
|
||||||
# This step runs tests that require a live backend server.
|
|
||||||
env:
|
env:
|
||||||
|
# --- Database credentials for both test suites ---
|
||||||
DB_HOST: ${{ secrets.DB_HOST }}
|
DB_HOST: ${{ secrets.DB_HOST }}
|
||||||
DB_PORT: ${{ secrets.DB_PORT }}
|
DB_PORT: ${{ secrets.DB_PORT }}
|
||||||
DB_USER: ${{ secrets.DB_USER }}
|
DB_USER: ${{ secrets.DB_USER }}
|
||||||
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
|
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
|
||||||
DB_DATABASE: "flyer-crawler-test"
|
DB_DATABASE: "flyer-crawler-test"
|
||||||
DB_NAME: "flyer-crawler-test"
|
DB_NAME: "flyer-crawler-test"
|
||||||
JWT_SECRET: "test-secret-for-ci"
|
|
||||||
|
|
||||||
# Auth dummies (Previous fix)
|
# --- Integration test specific variables ---
|
||||||
|
JWT_SECRET: "test-secret-for-ci"
|
||||||
GOOGLE_CLIENT_ID: "dummy_client_id"
|
GOOGLE_CLIENT_ID: "dummy_client_id"
|
||||||
GOOGLE_CLIENT_SECRET: "dummy_client_secret"
|
GOOGLE_CLIENT_SECRET: "dummy_client_secret"
|
||||||
GITHUB_CLIENT_ID: "dummy_github_id"
|
GITHUB_CLIENT_ID: "dummy_github_id"
|
||||||
GITHUB_CLIENT_SECRET: "dummy_github_secret"
|
GITHUB_CLIENT_SECRET: "dummy_github_secret"
|
||||||
FRONTEND_URL: "http://localhost:3000"
|
FRONTEND_URL: "http://localhost:3000"
|
||||||
|
|
||||||
# ✅ NEW: Provide the full backend URL for the Node.js test environment
|
|
||||||
VITE_API_BASE_URL: "http://localhost:3001/api"
|
VITE_API_BASE_URL: "http://localhost:3001/api"
|
||||||
|
|
||||||
# ✅ NEW: Backend requires this to start
|
|
||||||
GEMINI_API_KEY: ${{ secrets.VITE_GOOGLE_GENAI_API_KEY }}
|
GEMINI_API_KEY: ${{ secrets.VITE_GOOGLE_GENAI_API_KEY }}
|
||||||
|
|
||||||
run: npm run test:integration
|
run: npm run test:coverage
|
||||||
|
|
||||||
- name: Archive Code Coverage Report
|
- name: Archive Code Coverage Report
|
||||||
# This action saves the generated HTML coverage report as a downloadable artifact.
|
# This action saves the generated HTML coverage report as a downloadable artifact.
|
||||||
|
|||||||
Reference in New Issue
Block a user