- 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
313 lines
11 KiB
JavaScript
313 lines
11 KiB
JavaScript
// ========================================
|
|
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - TemporalStyles
|
|
// Module: human-simulation/TemporalStyles.js
|
|
// Générés le: 2025-09-06T03:38:48.147Z
|
|
// ========================================
|
|
|
|
const assert = require('assert');
|
|
const { test, describe } = require('node:test');
|
|
const TemporalStyles = require('../../human-simulation/TemporalStyles.js');
|
|
const { AIContentValidator } = require('../validators/AIContentValidator');
|
|
|
|
describe('TemporalStyles - Tests automatiques', () => {
|
|
|
|
// Setup avant les tests
|
|
let testContext = {};
|
|
|
|
test('Module loading', () => {
|
|
assert.ok(TemporalStyles, 'Module should be loaded');
|
|
console.log('📦 Module TemporalStyles loaded successfully');
|
|
});
|
|
|
|
|
|
test('getTemporalStyle - Basic Function', () => {
|
|
const input = "test_value";
|
|
|
|
try {
|
|
const result = TemporalStyles.getTemporalStyle(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ getTemporalStyle: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ getTemporalStyle: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('applyTemporalStyle - Basic Function', () => {
|
|
const input = ["Test content for validation", "test_value", { test: true }];
|
|
|
|
try {
|
|
const result = TemporalStyles.applyTemporalStyle(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ applyTemporalStyle: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ applyTemporalStyle: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('adjustSentenceLength - Basic Function', () => {
|
|
const input = ["Test content for validation", "test_value", "test_value"];
|
|
|
|
try {
|
|
const result = TemporalStyles.adjustSentenceLength(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ adjustSentenceLength: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ adjustSentenceLength: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('adaptVocabulary - Basic Function', () => {
|
|
const input = ["Test content for validation", "test_value", "test_value"];
|
|
|
|
try {
|
|
const result = TemporalStyles.adaptVocabulary(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ adaptVocabulary: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ adaptVocabulary: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('buildVocabularyReplacements - Content Generation', async () => {
|
|
const mockInput = ["test_value", "test_value"];
|
|
|
|
try {
|
|
const result = await TemporalStyles.buildVocabularyReplacements(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('✅ buildVocabularyReplacements: Content generated successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ buildVocabularyReplacements: Generation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('adjustConnectors - Basic Function', () => {
|
|
const input = ["Test content for validation", "test_value", "test_value"];
|
|
|
|
try {
|
|
const result = TemporalStyles.adjustConnectors(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ adjustConnectors: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ adjustConnectors: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('adjustRhythm - Basic Function', () => {
|
|
const input = ["Test content for validation", "test_value", "test_value"];
|
|
|
|
try {
|
|
const result = TemporalStyles.adjustRhythm(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ adjustRhythm: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ adjustRhythm: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('analyzeTemporalCoherence - Basic Function', () => {
|
|
const input = ["Test content for validation", "test_value"];
|
|
|
|
try {
|
|
const result = TemporalStyles.analyzeTemporalCoherence(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ analyzeTemporalCoherence: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ analyzeTemporalCoherence: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('calculateCoherenceScore - Basic Function', () => {
|
|
const input = ["test_value", "test_value"];
|
|
|
|
try {
|
|
const result = TemporalStyles.calculateCoherenceScore(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ calculateCoherenceScore: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ calculateCoherenceScore: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('if - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = TemporalStyles.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('for - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = TemporalStyles.for(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ for: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ for: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('switch - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = TemporalStyles.switch(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ switch: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ switch: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('Export - getTemporalStyle', () => {
|
|
assert.ok(TemporalStyles.getTemporalStyle !== undefined, 'Export getTemporalStyle should be available');
|
|
console.log('✅ Export getTemporalStyle: Available');
|
|
});
|
|
|
|
test('Export - applyTemporalStyle', () => {
|
|
assert.ok(TemporalStyles.applyTemporalStyle !== undefined, 'Export applyTemporalStyle should be available');
|
|
console.log('✅ Export applyTemporalStyle: Available');
|
|
});
|
|
|
|
test('Export - adjustSentenceLength', () => {
|
|
assert.ok(TemporalStyles.adjustSentenceLength !== undefined, 'Export adjustSentenceLength should be available');
|
|
console.log('✅ Export adjustSentenceLength: Available');
|
|
});
|
|
|
|
test('Export - adaptVocabulary', () => {
|
|
assert.ok(TemporalStyles.adaptVocabulary !== undefined, 'Export adaptVocabulary should be available');
|
|
console.log('✅ Export adaptVocabulary: Available');
|
|
});
|
|
|
|
test('Export - adjustConnectors', () => {
|
|
assert.ok(TemporalStyles.adjustConnectors !== undefined, 'Export adjustConnectors should be available');
|
|
console.log('✅ Export adjustConnectors: Available');
|
|
});
|
|
|
|
test('Export - adjustRhythm', () => {
|
|
assert.ok(TemporalStyles.adjustRhythm !== undefined, 'Export adjustRhythm should be available');
|
|
console.log('✅ Export adjustRhythm: Available');
|
|
});
|
|
|
|
test('Export - analyzeTemporalCoherence', () => {
|
|
assert.ok(TemporalStyles.analyzeTemporalCoherence !== undefined, 'Export analyzeTemporalCoherence should be available');
|
|
console.log('✅ Export analyzeTemporalCoherence: Available');
|
|
});
|
|
|
|
test('Export - calculateCoherenceScore', () => {
|
|
assert.ok(TemporalStyles.calculateCoherenceScore !== undefined, 'Export calculateCoherenceScore should be available');
|
|
console.log('✅ Export calculateCoherenceScore: Available');
|
|
});
|
|
|
|
test('Export - buildVocabularyReplacements', () => {
|
|
assert.ok(TemporalStyles.buildVocabularyReplacements !== undefined, 'Export buildVocabularyReplacements should be available');
|
|
console.log('✅ Export buildVocabularyReplacements: Available');
|
|
});
|
|
|
|
test('Export - TEMPORAL_STYLES', () => {
|
|
assert.ok(TemporalStyles.TEMPORAL_STYLES !== undefined, 'Export TEMPORAL_STYLES should be available');
|
|
console.log('✅ Export TEMPORAL_STYLES: Available');
|
|
});
|
|
|
|
|
|
// Test d'intégration général
|
|
test('Integration - Module health check', async () => {
|
|
try {
|
|
// Vérification exports
|
|
const exports = Object.keys(TemporalStyles);
|
|
assert.ok(exports.length > 0, 'Module should export functions');
|
|
|
|
console.log(`✅ TemporalStyles: ${exports.length} exports available`);
|
|
console.log('📋 Exports:', exports.join(', '));
|
|
|
|
} catch (error) {
|
|
console.error('❌ Integration test failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
}); |