fix for integration tests 404 ? not sure this is right
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user