- 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
166 lines
5.4 KiB
JavaScript
166 lines
5.4 KiB
JavaScript
// ========================================
|
|
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - ContentAssembly
|
|
// Module: ContentAssembly.js
|
|
// Générés le: 2025-09-06T03:38:47.926Z
|
|
// ========================================
|
|
|
|
const assert = require('assert');
|
|
const { test, describe } = require('node:test');
|
|
const ContentAssembly = require('../../ContentAssembly.js');
|
|
|
|
describe('ContentAssembly - Tests automatiques', () => {
|
|
|
|
// Setup avant les tests
|
|
let testContext = {};
|
|
|
|
test('Module loading', () => {
|
|
assert.ok(ContentAssembly, 'Module should be loaded');
|
|
console.log('📦 Module ContentAssembly loaded successfully');
|
|
});
|
|
|
|
|
|
test('cleanStrongTags - Basic Function', () => {
|
|
const input = "test_value";
|
|
|
|
try {
|
|
const result = ContentAssembly.cleanStrongTags(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ cleanStrongTags: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ cleanStrongTags: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('replaceAllCSVVariables - Basic Function', () => {
|
|
const input = ["test_value", { mc0: "test keyword", t0: "Test title" }];
|
|
|
|
try {
|
|
const result = ContentAssembly.replaceAllCSVVariables(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ replaceAllCSVVariables: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ replaceAllCSVVariables: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('injectGeneratedContent - Basic Function', () => {
|
|
const input = ["test_value", "test_value", "test_value"];
|
|
|
|
try {
|
|
const result = ContentAssembly.injectGeneratedContent(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ injectGeneratedContent: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ injectGeneratedContent: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('findOriginalTagInXML - Basic Function', () => {
|
|
const input = ["test_value", "test_value"];
|
|
|
|
try {
|
|
const result = ContentAssembly.findOriginalTagInXML(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ findOriginalTagInXML: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ findOriginalTagInXML: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('if - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = ContentAssembly.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 = ContentAssembly.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 - cleanStrongTags', () => {
|
|
assert.ok(ContentAssembly.cleanStrongTags !== undefined, 'Export cleanStrongTags should be available');
|
|
console.log('✅ Export cleanStrongTags: Available');
|
|
});
|
|
|
|
test('Export - replaceAllCSVVariables', () => {
|
|
assert.ok(ContentAssembly.replaceAllCSVVariables !== undefined, 'Export replaceAllCSVVariables should be available');
|
|
console.log('✅ Export replaceAllCSVVariables: Available');
|
|
});
|
|
|
|
test('Export - injectGeneratedContent', () => {
|
|
assert.ok(ContentAssembly.injectGeneratedContent !== undefined, 'Export injectGeneratedContent should be available');
|
|
console.log('✅ Export injectGeneratedContent: Available');
|
|
});
|
|
|
|
test('Export - findOriginalTagInXML', () => {
|
|
assert.ok(ContentAssembly.findOriginalTagInXML !== undefined, 'Export findOriginalTagInXML should be available');
|
|
console.log('✅ Export findOriginalTagInXML: Available');
|
|
});
|
|
|
|
|
|
// Test d'intégration général
|
|
test('Integration - Module health check', async () => {
|
|
try {
|
|
// Vérification exports
|
|
const exports = Object.keys(ContentAssembly);
|
|
assert.ok(exports.length > 0, 'Module should export functions');
|
|
|
|
console.log(`✅ ContentAssembly: ${exports.length} exports available`);
|
|
console.log('📋 Exports:', exports.join(', '));
|
|
|
|
} catch (error) {
|
|
console.error('❌ Integration test failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
}); |