- 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
319 lines
11 KiB
JavaScript
319 lines
11 KiB
JavaScript
// ========================================
|
|
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - TransitionHumanization
|
|
// Module: post-processing/TransitionHumanization.js
|
|
// Générés le: 2025-09-06T03:38:48.227Z
|
|
// ========================================
|
|
|
|
const assert = require('assert');
|
|
const { test, describe } = require('node:test');
|
|
const TransitionHumanization = require('../../post-processing/TransitionHumanization.js');
|
|
|
|
describe('TransitionHumanization - Tests automatiques', () => {
|
|
|
|
// Setup avant les tests
|
|
let testContext = {};
|
|
|
|
test('Module loading', () => {
|
|
assert.ok(TransitionHumanization, 'Module should be loaded');
|
|
console.log('📦 Module TransitionHumanization loaded successfully');
|
|
});
|
|
|
|
|
|
test('humanizeTransitions - Async Operation', async () => {
|
|
const input = "test_value";
|
|
|
|
try {
|
|
const startTime = Date.now();
|
|
const result = await TransitionHumanization.humanizeTransitions(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(`✅ humanizeTransitions: Completed in ${duration}ms`);
|
|
|
|
} catch (error) {
|
|
console.error('❌ humanizeTransitions: Async operation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('humanizeTextTransitions - Basic Function', () => {
|
|
const input = ["Sample text for processing", "test_value"];
|
|
|
|
try {
|
|
const result = TransitionHumanization.humanizeTextTransitions(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ humanizeTextTransitions: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ humanizeTextTransitions: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('selectBestTransitionAlternative - Basic Function', () => {
|
|
const input = ["test_value", { nom: "Marc", style: "technique" }, "test_value", "test_value"];
|
|
|
|
try {
|
|
const result = TransitionHumanization.selectBestTransitionAlternative(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ selectBestTransitionAlternative: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ selectBestTransitionAlternative: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('isPersonalityAppropriate - Basic Function', () => {
|
|
const input = ["test_value", { nom: "Marc", style: "technique" }];
|
|
|
|
try {
|
|
const result = TransitionHumanization.isPersonalityAppropriate(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ isPersonalityAppropriate: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ isPersonalityAppropriate: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('reduceTransitionRepetition - Basic Function', () => {
|
|
const input = ["Sample text for processing", "test_value"];
|
|
|
|
try {
|
|
const result = TransitionHumanization.reduceTransitionRepetition(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ reduceTransitionRepetition: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ reduceTransitionRepetition: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('findAlternativesFor - Basic Function', () => {
|
|
const input = "test_value";
|
|
|
|
try {
|
|
const result = TransitionHumanization.findAlternativesFor(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ findAlternativesFor: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ findAlternativesFor: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('analyzeGlobalTransitionPatterns - Basic Function', () => {
|
|
const input = "Test content for validation";
|
|
|
|
try {
|
|
const result = TransitionHumanization.analyzeGlobalTransitionPatterns(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ analyzeGlobalTransitionPatterns: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ analyzeGlobalTransitionPatterns: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('preserveCase - Basic Function', () => {
|
|
const input = ["test_value", "test_value"];
|
|
|
|
try {
|
|
const result = TransitionHumanization.preserveCase(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ preserveCase: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ preserveCase: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('escapeRegex - Basic Function', () => {
|
|
const input = "Sample text for processing";
|
|
|
|
try {
|
|
const result = TransitionHumanization.escapeRegex(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ escapeRegex: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ escapeRegex: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('analyzeTransitionQuality - Basic Function', () => {
|
|
const input = "Sample text for processing";
|
|
|
|
try {
|
|
const result = TransitionHumanization.analyzeTransitionQuality(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ analyzeTransitionQuality: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ analyzeTransitionQuality: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('if - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = TransitionHumanization.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 = TransitionHumanization.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('for - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = TransitionHumanization.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('Export - humanizeTransitions', () => {
|
|
assert.ok(TransitionHumanization.humanizeTransitions !== undefined, 'Export humanizeTransitions should be available');
|
|
console.log('✅ Export humanizeTransitions: Available');
|
|
});
|
|
|
|
test('Export - MAIN', () => {
|
|
assert.ok(TransitionHumanization.MAIN !== undefined, 'Export MAIN should be available');
|
|
console.log('✅ Export MAIN: Available');
|
|
});
|
|
|
|
test('Export - ENTRY', () => {
|
|
assert.ok(TransitionHumanization.ENTRY !== undefined, 'Export ENTRY should be available');
|
|
console.log('✅ Export ENTRY: Available');
|
|
});
|
|
|
|
test('Export - POINT', () => {
|
|
assert.ok(TransitionHumanization.POINT !== undefined, 'Export POINT should be available');
|
|
console.log('✅ Export POINT: Available');
|
|
});
|
|
|
|
test('Export - humanizeTextTransitions', () => {
|
|
assert.ok(TransitionHumanization.humanizeTextTransitions !== undefined, 'Export humanizeTextTransitions should be available');
|
|
console.log('✅ Export humanizeTextTransitions: Available');
|
|
});
|
|
|
|
test('Export - analyzeTransitionQuality', () => {
|
|
assert.ok(TransitionHumanization.analyzeTransitionQuality !== undefined, 'Export analyzeTransitionQuality should be available');
|
|
console.log('✅ Export analyzeTransitionQuality: Available');
|
|
});
|
|
|
|
test('Export - analyzeGlobalTransitionPatterns', () => {
|
|
assert.ok(TransitionHumanization.analyzeGlobalTransitionPatterns !== undefined, 'Export analyzeGlobalTransitionPatterns should be available');
|
|
console.log('✅ Export analyzeGlobalTransitionPatterns: Available');
|
|
});
|
|
|
|
test('Export - TRANSITION_REPLACEMENTS', () => {
|
|
assert.ok(TransitionHumanization.TRANSITION_REPLACEMENTS !== undefined, 'Export TRANSITION_REPLACEMENTS should be available');
|
|
console.log('✅ Export TRANSITION_REPLACEMENTS: Available');
|
|
});
|
|
|
|
test('Export - PERSONALITY_TRANSITIONS', () => {
|
|
assert.ok(TransitionHumanization.PERSONALITY_TRANSITIONS !== undefined, 'Export PERSONALITY_TRANSITIONS should be available');
|
|
console.log('✅ Export PERSONALITY_TRANSITIONS: Available');
|
|
});
|
|
|
|
|
|
// Test d'intégration général
|
|
test('Integration - Module health check', async () => {
|
|
try {
|
|
// Vérification exports
|
|
const exports = Object.keys(TransitionHumanization);
|
|
assert.ok(exports.length > 0, 'Module should export functions');
|
|
|
|
console.log(`✅ TransitionHumanization: ${exports.length} exports available`);
|
|
console.log('📋 Exports:', exports.join(', '));
|
|
|
|
} catch (error) {
|
|
console.error('❌ Integration test failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
}); |