- Add intermediate saves (v1.0-v1.4) to Generated_Articles_Versioned - Fix compiled_text pipeline (generatedTexts object structure) - Add /api/workflow-modulaire endpoint with version tracking - Create test-modulaire.html interface with real-time logs - Support parent-child linking via Parent_Article_ID
227 lines
8.1 KiB
JavaScript
227 lines
8.1 KiB
JavaScript
// ========================================
|
|
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - HumanSimulationCore
|
|
// Module: human-simulation/HumanSimulationCore.js
|
|
// Générés le: 2025-09-06T03:38:48.121Z
|
|
// ========================================
|
|
|
|
const assert = require('assert');
|
|
const { test, describe } = require('node:test');
|
|
const HumanSimulationCore = require('../../human-simulation/HumanSimulationCore.js');
|
|
|
|
describe('HumanSimulationCore - Tests automatiques', () => {
|
|
|
|
// Setup avant les tests
|
|
let testContext = {};
|
|
|
|
test('Module loading', () => {
|
|
assert.ok(HumanSimulationCore, 'Module should be loaded');
|
|
console.log('📦 Module HumanSimulationCore loaded successfully');
|
|
});
|
|
|
|
|
|
test('applyHumanSimulationLayer - Async Operation', async () => {
|
|
const input = ["Test content for validation", { test: true }];
|
|
|
|
try {
|
|
const startTime = Date.now();
|
|
const result = await HumanSimulationCore.applyHumanSimulationLayer(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(`✅ applyHumanSimulationLayer: Completed in ${duration}ms`);
|
|
|
|
} catch (error) {
|
|
console.error('❌ applyHumanSimulationLayer: Async operation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('analyzeGlobalContext - Async Operation', async () => {
|
|
const input = ["Test content for validation", "test_value"];
|
|
|
|
try {
|
|
const startTime = Date.now();
|
|
const result = await HumanSimulationCore.analyzeGlobalContext(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(`✅ analyzeGlobalContext: Completed in ${duration}ms`);
|
|
|
|
} catch (error) {
|
|
console.error('❌ analyzeGlobalContext: Async operation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('applyFatigueSimulation - Async Operation', async () => {
|
|
const input = ["Test content for validation", "Sample text for processing", "test_value"];
|
|
|
|
try {
|
|
const startTime = Date.now();
|
|
const result = await HumanSimulationCore.applyFatigueSimulation(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(`✅ applyFatigueSimulation: Completed in ${duration}ms`);
|
|
|
|
} catch (error) {
|
|
console.error('❌ applyFatigueSimulation: Async operation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('applyPersonalitySimulation - Async Operation', async () => {
|
|
const input = ["Test content for validation", "Sample text for processing", "test_value"];
|
|
|
|
try {
|
|
const startTime = Date.now();
|
|
const result = await HumanSimulationCore.applyPersonalitySimulation(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(`✅ applyPersonalitySimulation: Completed in ${duration}ms`);
|
|
|
|
} catch (error) {
|
|
console.error('❌ applyPersonalitySimulation: Async operation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('applyTemporalSimulation - Async Operation', async () => {
|
|
const input = ["Test content for validation", "Sample text for processing", "test_value"];
|
|
|
|
try {
|
|
const startTime = Date.now();
|
|
const result = await HumanSimulationCore.applyTemporalSimulation(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(`✅ applyTemporalSimulation: Completed in ${duration}ms`);
|
|
|
|
} catch (error) {
|
|
console.error('❌ applyTemporalSimulation: Async operation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('calculateGlobalQualityScore - Basic Function', () => {
|
|
const input = ["test_value", "test_value"];
|
|
|
|
try {
|
|
const result = HumanSimulationCore.calculateGlobalQualityScore(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ calculateGlobalQualityScore: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ calculateGlobalQualityScore: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('if - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = HumanSimulationCore.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 = HumanSimulationCore.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('Export - applyHumanSimulationLayer', () => {
|
|
assert.ok(HumanSimulationCore.applyHumanSimulationLayer !== undefined, 'Export applyHumanSimulationLayer should be available');
|
|
console.log('✅ Export applyHumanSimulationLayer: Available');
|
|
});
|
|
|
|
test('Export - analyzeGlobalContext', () => {
|
|
assert.ok(HumanSimulationCore.analyzeGlobalContext !== undefined, 'Export analyzeGlobalContext should be available');
|
|
console.log('✅ Export analyzeGlobalContext: Available');
|
|
});
|
|
|
|
test('Export - applyFatigueSimulation', () => {
|
|
assert.ok(HumanSimulationCore.applyFatigueSimulation !== undefined, 'Export applyFatigueSimulation should be available');
|
|
console.log('✅ Export applyFatigueSimulation: Available');
|
|
});
|
|
|
|
test('Export - applyPersonalitySimulation', () => {
|
|
assert.ok(HumanSimulationCore.applyPersonalitySimulation !== undefined, 'Export applyPersonalitySimulation should be available');
|
|
console.log('✅ Export applyPersonalitySimulation: Available');
|
|
});
|
|
|
|
test('Export - applyTemporalSimulation', () => {
|
|
assert.ok(HumanSimulationCore.applyTemporalSimulation !== undefined, 'Export applyTemporalSimulation should be available');
|
|
console.log('✅ Export applyTemporalSimulation: Available');
|
|
});
|
|
|
|
test('Export - calculateGlobalQualityScore', () => {
|
|
assert.ok(HumanSimulationCore.calculateGlobalQualityScore !== undefined, 'Export calculateGlobalQualityScore should be available');
|
|
console.log('✅ Export calculateGlobalQualityScore: Available');
|
|
});
|
|
|
|
test('Export - DEFAULT_CONFIG', () => {
|
|
assert.ok(HumanSimulationCore.DEFAULT_CONFIG !== undefined, 'Export DEFAULT_CONFIG should be available');
|
|
console.log('✅ Export DEFAULT_CONFIG: Available');
|
|
});
|
|
|
|
|
|
// Test d'intégration général
|
|
test('Integration - Module health check', async () => {
|
|
try {
|
|
// Vérification exports
|
|
const exports = Object.keys(HumanSimulationCore);
|
|
assert.ok(exports.length > 0, 'Module should export functions');
|
|
|
|
console.log(`✅ HumanSimulationCore: ${exports.length} exports available`);
|
|
console.log('📋 Exports:', exports.join(', '));
|
|
|
|
} catch (error) {
|
|
console.error('❌ Integration test failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
}); |