Files
flyer-crawler.projectium.com/src/tests/integration/system.integration.test.ts

28 lines
1.0 KiB
TypeScript

// src/tests/integration/system.integration.test.ts
import { describe, it, expect } from 'vitest';
import supertest from 'supertest';
import app from '../../../server';
/**
* @vitest-environment node
*/
describe('System API Routes Integration Tests', () => {
describe('GET /api/system/pm2-status', () => {
it('should return a status for PM2', async () => {
const request = supertest(app);
// In a typical CI environment without PM2, this will fail gracefully.
// The test verifies that the endpoint responds correctly, even if PM2 isn't running.
const response = await request.get('/api/system/pm2-status');
const result = response.body;
expect(result).toBeDefined();
expect(result).toHaveProperty('message');
// If the response is successful (200 OK), it must have a 'success' property.
// If it's an error (e.g., 500 because pm2 command not found), it will only have 'message'.
if (response.status === 200) {
expect(result).toHaveProperty('success');
}
});
});
});