704 lines
22 KiB
JavaScript
704 lines
22 KiB
JavaScript
// ========================================
|
|
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - ManualServer
|
|
// Module: modes/ManualServer.js
|
|
// Générés le: 2025-09-08T23:48:03.015Z
|
|
// ========================================
|
|
|
|
const assert = require('assert');
|
|
const { test, describe } = require('node:test');
|
|
const ManualServer = require('../../modes/ManualServer.js');
|
|
const { AIContentValidator } = require('../validators/AIContentValidator');
|
|
|
|
describe('ManualServer - Tests automatiques', () => {
|
|
|
|
// Setup avant les tests
|
|
let testContext = {};
|
|
|
|
test('Module loading', () => {
|
|
assert.ok(ManualServer, 'Module should be loaded');
|
|
console.log('📦 Module ManualServer loaded successfully');
|
|
});
|
|
|
|
|
|
test('testConnection - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = ManualServer.testConnection(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ testConnection: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ testConnection: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('startLogViewer - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = ManualServer.startLogViewer(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ startLogViewer: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ startLogViewer: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('connectWebSocket - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = ManualServer.connectWebSocket(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ connectWebSocket: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ connectWebSocket: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('start - Async Operation', async () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const startTime = Date.now();
|
|
const result = await ManualServer.start(input);
|
|
const duration = Date.now() - startTime;
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(duration < 30000, 'Should complete within 30 seconds');
|
|
|
|
console.log(`✅ start: Completed in ${duration}ms`);
|
|
|
|
} catch (error) {
|
|
console.error('❌ start: Async operation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('if - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = ManualServer.if(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ if: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ if: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('catch - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = ManualServer.catch(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ catch: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ catch: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('stop - Async Operation', async () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const startTime = Date.now();
|
|
const result = await ManualServer.stop(input);
|
|
const duration = Date.now() - startTime;
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(duration < 30000, 'Should complete within 30 seconds');
|
|
|
|
console.log(`✅ stop: Completed in ${duration}ms`);
|
|
|
|
} catch (error) {
|
|
console.error('❌ stop: Async operation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('setupExpressApp - Async Operation', async () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const startTime = Date.now();
|
|
const result = await ManualServer.setupExpressApp(input);
|
|
const duration = Date.now() - startTime;
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(duration < 30000, 'Should complete within 30 seconds');
|
|
|
|
console.log(`✅ setupExpressApp: Completed in ${duration}ms`);
|
|
|
|
} catch (error) {
|
|
console.error('❌ setupExpressApp: Async operation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('setupAPIRoutes - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = ManualServer.setupAPIRoutes(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ setupAPIRoutes: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ setupAPIRoutes: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('handleTestModulaire - Async Operation', async () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const startTime = Date.now();
|
|
const result = await ManualServer.handleTestModulaire(input);
|
|
const duration = Date.now() - startTime;
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(duration < 30000, 'Should complete within 30 seconds');
|
|
|
|
console.log(`✅ handleTestModulaire: Completed in ${duration}ms`);
|
|
|
|
} catch (error) {
|
|
console.error('❌ handleTestModulaire: Async operation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('handleBenchmarkModulaire - Async Operation', async () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const startTime = Date.now();
|
|
const result = await ManualServer.handleBenchmarkModulaire(input);
|
|
const duration = Date.now() - startTime;
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(duration < 30000, 'Should complete within 30 seconds');
|
|
|
|
console.log(`✅ handleBenchmarkModulaire: Completed in ${duration}ms`);
|
|
|
|
} catch (error) {
|
|
console.error('❌ handleBenchmarkModulaire: Async operation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('handleWorkflowModulaire - Async Operation', async () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const startTime = Date.now();
|
|
const result = await ManualServer.handleWorkflowModulaire(input);
|
|
const duration = Date.now() - startTime;
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(duration < 30000, 'Should complete within 30 seconds');
|
|
|
|
console.log(`✅ handleWorkflowModulaire: Completed in ${duration}ms`);
|
|
|
|
} catch (error) {
|
|
console.error('❌ handleWorkflowModulaire: Async operation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('handleModulaireConfig - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = ManualServer.handleModulaireConfig(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ handleModulaireConfig: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ handleModulaireConfig: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('handleStartLogViewer - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = ManualServer.handleStartLogViewer(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ handleStartLogViewer: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ handleStartLogViewer: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('handleStepByStepInit - Async Operation', async () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const startTime = Date.now();
|
|
const result = await ManualServer.handleStepByStepInit(input);
|
|
const duration = Date.now() - startTime;
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(duration < 30000, 'Should complete within 30 seconds');
|
|
|
|
console.log(`✅ handleStepByStepInit: Completed in ${duration}ms`);
|
|
|
|
} catch (error) {
|
|
console.error('❌ handleStepByStepInit: Async operation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('handleStepByStepExecute - Async Operation', async () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const startTime = Date.now();
|
|
const result = await ManualServer.handleStepByStepExecute(input);
|
|
const duration = Date.now() - startTime;
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(duration < 30000, 'Should complete within 30 seconds');
|
|
|
|
console.log(`✅ handleStepByStepExecute: Completed in ${duration}ms`);
|
|
|
|
} catch (error) {
|
|
console.error('❌ handleStepByStepExecute: Async operation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('handleStepByStepStatus - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = ManualServer.handleStepByStepStatus(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ handleStepByStepStatus: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ handleStepByStepStatus: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('handleStepByStepReset - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = ManualServer.handleStepByStepReset(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ handleStepByStepReset: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ handleStepByStepReset: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('handleStepByStepExport - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = ManualServer.handleStepByStepExport(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ handleStepByStepExport: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ handleStepByStepExport: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('handleStepByStepSessions - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = ManualServer.handleStepByStepSessions(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ handleStepByStepSessions: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ handleStepByStepSessions: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('handleGetPersonalities - Async Operation', async () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const startTime = Date.now();
|
|
const result = await ManualServer.handleGetPersonalities(input);
|
|
const duration = Date.now() - startTime;
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(duration < 30000, 'Should complete within 30 seconds');
|
|
|
|
console.log(`✅ handleGetPersonalities: Completed in ${duration}ms`);
|
|
|
|
} catch (error) {
|
|
console.error('❌ handleGetPersonalities: Async operation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('setupWebInterface - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = ManualServer.setupWebInterface(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ setupWebInterface: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ setupWebInterface: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('generateManualDashboard - Content Generation', async () => {
|
|
const mockInput = undefined;
|
|
|
|
try {
|
|
const result = await ManualServer.generateManualDashboard(mockInput);
|
|
|
|
// Validations de base
|
|
assert.ok(result, 'Should return a result');
|
|
assert.ok(typeof result === 'string' || typeof result === 'object', 'Should return content');
|
|
|
|
// Validation IA si contenu texte
|
|
if (typeof result === 'string' && result.length > 50) {
|
|
const validation = await AIContentValidator.quickValidate(result, {
|
|
context: 'Generated content test'
|
|
});
|
|
assert.ok(validation.overall >= 40, 'Content quality should be acceptable');
|
|
}
|
|
|
|
console.log('✅ generateManualDashboard: Content generated successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ generateManualDashboard: Generation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('then - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = ManualServer.then(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ then: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ then: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('setupWebSocketServer - Async Operation', async () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const startTime = Date.now();
|
|
const result = await ManualServer.setupWebSocketServer(input);
|
|
const duration = Date.now() - startTime;
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(duration < 30000, 'Should complete within 30 seconds');
|
|
|
|
console.log(`✅ setupWebSocketServer: Completed in ${duration}ms`);
|
|
|
|
} catch (error) {
|
|
console.error('❌ setupWebSocketServer: Async operation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('handleWebSocketConnection - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = ManualServer.handleWebSocketConnection(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ handleWebSocketConnection: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ handleWebSocketConnection: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('broadcastToClients - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = ManualServer.broadcastToClients(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ broadcastToClients: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ broadcastToClients: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('forEach - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = ManualServer.forEach(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ forEach: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ forEach: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('disconnectAllClients - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = ManualServer.disconnectAllClients(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ disconnectAllClients: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ disconnectAllClients: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('startHTTPServer - Async Operation', async () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const startTime = Date.now();
|
|
const result = await ManualServer.startHTTPServer(input);
|
|
const duration = Date.now() - startTime;
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(duration < 30000, 'Should complete within 30 seconds');
|
|
|
|
console.log(`✅ startHTTPServer: Completed in ${duration}ms`);
|
|
|
|
} catch (error) {
|
|
console.error('❌ startHTTPServer: Async operation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('startMonitoring - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = ManualServer.startMonitoring(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ startMonitoring: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ startMonitoring: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('performMonitoring - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = ManualServer.performMonitoring(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ performMonitoring: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ performMonitoring: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('cleanupDeadClients - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = ManualServer.cleanupDeadClients(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ cleanupDeadClients: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ cleanupDeadClients: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('hasActiveClients - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = ManualServer.hasActiveClients(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ hasActiveClients: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ hasActiveClients: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('getStatus - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = ManualServer.getStatus(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ getStatus: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ getStatus: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('Export - ManualServer', () => {
|
|
assert.ok(ManualServer.ManualServer !== undefined, 'Export ManualServer should be available');
|
|
console.log('✅ Export ManualServer: Available');
|
|
});
|
|
|
|
|
|
// Test d'intégration général
|
|
test('Integration - Module health check', async () => {
|
|
try {
|
|
// Vérification exports
|
|
const exports = Object.keys(ManualServer);
|
|
assert.ok(exports.length > 0, 'Module should export functions');
|
|
|
|
console.log(`✅ ManualServer: ${exports.length} exports available`);
|
|
console.log('📋 Exports:', exports.join(', '));
|
|
|
|
} catch (error) {
|
|
console.error('❌ Integration test failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
}); |