- 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
281 lines
9.4 KiB
JavaScript
281 lines
9.4 KiB
JavaScript
// ========================================
|
|
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - SyntaxVariations
|
|
// Module: pattern-breaking/SyntaxVariations.js
|
|
// Générés le: 2025-09-06T03:38:48.204Z
|
|
// ========================================
|
|
|
|
const assert = require('assert');
|
|
const { test, describe } = require('node:test');
|
|
const SyntaxVariations = require('../../pattern-breaking/SyntaxVariations.js');
|
|
|
|
describe('SyntaxVariations - Tests automatiques', () => {
|
|
|
|
// Setup avant les tests
|
|
let testContext = {};
|
|
|
|
test('Module loading', () => {
|
|
assert.ok(SyntaxVariations, 'Module should be loaded');
|
|
console.log('📦 Module SyntaxVariations loaded successfully');
|
|
});
|
|
|
|
|
|
test('varyStructures - Basic Function', () => {
|
|
const input = ["Sample text for processing", "test_value", { test: true }];
|
|
|
|
try {
|
|
const result = SyntaxVariations.varyStructures(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ varyStructures: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ varyStructures: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('analyzeSentenceStructure - Basic Function', () => {
|
|
const input = "Sample text for processing";
|
|
|
|
try {
|
|
const result = SyntaxVariations.analyzeSentenceStructure(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ analyzeSentenceStructure: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ analyzeSentenceStructure: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('splitLongSentences - Basic Function', () => {
|
|
const input = ["Sample text for processing", "test_value"];
|
|
|
|
try {
|
|
const result = SyntaxVariations.splitLongSentences(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ splitLongSentences: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ splitLongSentences: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('mergeShorter - Basic Function', () => {
|
|
const input = ["Sample text for processing", "test_value"];
|
|
|
|
try {
|
|
const result = SyntaxVariations.mergeShorter(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ mergeShorter: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ mergeShorter: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('reorganizeStructures - Basic Function', () => {
|
|
const input = ["Sample text for processing", "test_value"];
|
|
|
|
try {
|
|
const result = SyntaxVariations.reorganizeStructures(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ reorganizeStructures: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ reorganizeStructures: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('fixRepetitiveStarts - Basic Function', () => {
|
|
const input = "Sample text for processing";
|
|
|
|
try {
|
|
const result = SyntaxVariations.fixRepetitiveStarts(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ fixRepetitiveStarts: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ fixRepetitiveStarts: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('detectUniformLengths - Basic Function', () => {
|
|
const input = "Sample text for processing";
|
|
|
|
try {
|
|
const result = SyntaxVariations.detectUniformLengths(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ detectUniformLengths: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ detectUniformLengths: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('addMicroVariations - Basic Function', () => {
|
|
const input = ["Sample text for processing", "test_value"];
|
|
|
|
try {
|
|
const result = SyntaxVariations.addMicroVariations(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ addMicroVariations: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ addMicroVariations: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('if - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = SyntaxVariations.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 = SyntaxVariations.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 = SyntaxVariations.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 - varyStructures', () => {
|
|
assert.ok(SyntaxVariations.varyStructures !== undefined, 'Export varyStructures should be available');
|
|
console.log('✅ Export varyStructures: Available');
|
|
});
|
|
|
|
test('Export - splitLongSentences', () => {
|
|
assert.ok(SyntaxVariations.splitLongSentences !== undefined, 'Export splitLongSentences should be available');
|
|
console.log('✅ Export splitLongSentences: Available');
|
|
});
|
|
|
|
test('Export - mergeShorter', () => {
|
|
assert.ok(SyntaxVariations.mergeShorter !== undefined, 'Export mergeShorter should be available');
|
|
console.log('✅ Export mergeShorter: Available');
|
|
});
|
|
|
|
test('Export - reorganizeStructures', () => {
|
|
assert.ok(SyntaxVariations.reorganizeStructures !== undefined, 'Export reorganizeStructures should be available');
|
|
console.log('✅ Export reorganizeStructures: Available');
|
|
});
|
|
|
|
test('Export - fixRepetitiveStarts', () => {
|
|
assert.ok(SyntaxVariations.fixRepetitiveStarts !== undefined, 'Export fixRepetitiveStarts should be available');
|
|
console.log('✅ Export fixRepetitiveStarts: Available');
|
|
});
|
|
|
|
test('Export - analyzeSentenceStructure', () => {
|
|
assert.ok(SyntaxVariations.analyzeSentenceStructure !== undefined, 'Export analyzeSentenceStructure should be available');
|
|
console.log('✅ Export analyzeSentenceStructure: Available');
|
|
});
|
|
|
|
test('Export - detectUniformLengths', () => {
|
|
assert.ok(SyntaxVariations.detectUniformLengths !== undefined, 'Export detectUniformLengths should be available');
|
|
console.log('✅ Export detectUniformLengths: Available');
|
|
});
|
|
|
|
test('Export - addMicroVariations', () => {
|
|
assert.ok(SyntaxVariations.addMicroVariations !== undefined, 'Export addMicroVariations should be available');
|
|
console.log('✅ Export addMicroVariations: Available');
|
|
});
|
|
|
|
test('Export - LLM_SYNTAX_PATTERNS', () => {
|
|
assert.ok(SyntaxVariations.LLM_SYNTAX_PATTERNS !== undefined, 'Export LLM_SYNTAX_PATTERNS should be available');
|
|
console.log('✅ Export LLM_SYNTAX_PATTERNS: Available');
|
|
});
|
|
|
|
|
|
// Test d'intégration général
|
|
test('Integration - Module health check', async () => {
|
|
try {
|
|
// Vérification exports
|
|
const exports = Object.keys(SyntaxVariations);
|
|
assert.ok(exports.length > 0, 'Module should export functions');
|
|
|
|
console.log(`✅ SyntaxVariations: ${exports.length} exports available`);
|
|
console.log('📋 Exports:', exports.join(', '));
|
|
|
|
} catch (error) {
|
|
console.error('❌ Integration test failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
}); |