fix for integration tests 404 ? not sure this is right

This commit is contained in:
2025-12-23 18:13:35 -08:00
parent e8c894d5cf
commit a6a484d432

View File

@@ -1,6 +1,7 @@
// src/tests/integration/public.routes.integration.test.ts
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
import supertest from 'supertest';
import app from '../../../server';
import type {
Flyer,
FlyerItem,
@@ -13,8 +14,11 @@ import type {
import { getPool } from '../../services/db/connection.db';
import { createAndLoginUser } from '../utils/testHelpers';
const API_URL = process.env.VITE_API_BASE_URL || 'http://localhost:3001/api';
const request = supertest(API_URL.replace('/api', '')); // supertest needs the server's base URL
/**
* @vitest-environment node
*/
const request = supertest(app);
describe('Public API Routes Integration Tests', () => {
// Shared state for tests
@@ -100,8 +104,8 @@ describe('Public API Routes Integration Tests', () => {
});
describe('Public Data Endpoints', () => {
it('GET /api/time should return the server time', async () => {
const response = await request.get('/api/time');
it('GET /api/health/time should return the server time', async () => {
const response = await request.get('/api/health/time');
expect(response.status).toBe(200);
expect(response.body).toHaveProperty('currentTime');
expect(response.body).toHaveProperty('year');