977 lines
35 KiB
JavaScript
977 lines
35 KiB
JavaScript
// ========================================
|
|
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - SelectiveEnhancement
|
|
// Module: SelectiveEnhancement.js
|
|
// Générés le: 2025-09-08T23:48:02.525Z
|
|
// ========================================
|
|
|
|
const assert = require('assert');
|
|
const { test, describe } = require('node:test');
|
|
const SelectiveEnhancement = require('../../SelectiveEnhancement.js');
|
|
const { AIContentValidator } = require('../validators/AIContentValidator');
|
|
|
|
describe('SelectiveEnhancement - Tests automatiques', () => {
|
|
|
|
// Setup avant les tests
|
|
let testContext = {};
|
|
|
|
test('Module loading', () => {
|
|
assert.ok(SelectiveEnhancement, 'Module should be loaded');
|
|
console.log('📦 Module SelectiveEnhancement loaded successfully');
|
|
});
|
|
|
|
|
|
test('generateWithBatchEnhancement - Content Generation', async () => {
|
|
const mockInput = ["test_value", { mc0: "test keyword", t0: "Test title" }];
|
|
|
|
try {
|
|
const result = await SelectiveEnhancement.generateWithBatchEnhancement(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('✅ generateWithBatchEnhancement: Content generated successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ generateWithBatchEnhancement: Generation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('generateAllContentBase - Content Generation', async () => {
|
|
const mockInput = ["test_value", { mc0: "test keyword", t0: "Test title" }, "test_value"];
|
|
|
|
try {
|
|
const result = await SelectiveEnhancement.generateAllContentBase(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('✅ generateAllContentBase: Content generated successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ generateAllContentBase: Generation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('enhanceAllTechnicalTerms - Async Operation', async () => {
|
|
const input = ["test_value", { mc0: "test keyword", t0: "Test title" }, "test_value"];
|
|
|
|
try {
|
|
const startTime = Date.now();
|
|
const result = await SelectiveEnhancement.enhanceAllTechnicalTerms(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(`✅ enhanceAllTechnicalTerms: Completed in ${duration}ms`);
|
|
|
|
} catch (error) {
|
|
console.error('❌ enhanceAllTechnicalTerms: Async operation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('analyzeSingleElementTechnicalTerms - Async Operation', async () => {
|
|
const input = ["test_value", "Test content for validation", { mc0: "test keyword", t0: "Test title" }, "test_value"];
|
|
|
|
try {
|
|
const startTime = Date.now();
|
|
const result = await SelectiveEnhancement.analyzeSingleElementTechnicalTerms(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(`✅ analyzeSingleElementTechnicalTerms: Completed in ${duration}ms`);
|
|
|
|
} catch (error) {
|
|
console.error('❌ analyzeSingleElementTechnicalTerms: Async operation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('enhanceSingleElementTechnical - Async Operation', async () => {
|
|
const input = ["test_value", "Test content for validation", { mc0: "test keyword", t0: "Test title" }, "test_value"];
|
|
|
|
try {
|
|
const startTime = Date.now();
|
|
const result = await SelectiveEnhancement.enhanceSingleElementTechnical(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(`✅ enhanceSingleElementTechnical: Completed in ${duration}ms`);
|
|
|
|
} catch (error) {
|
|
console.error('❌ enhanceSingleElementTechnical: Async operation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('enhanceAllTransitions - Async Operation', async () => {
|
|
const input = ["test_value", { mc0: "test keyword", t0: "Test title" }, "test_value"];
|
|
|
|
try {
|
|
const startTime = Date.now();
|
|
const result = await SelectiveEnhancement.enhanceAllTransitions(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(`✅ enhanceAllTransitions: Completed in ${duration}ms`);
|
|
|
|
} catch (error) {
|
|
console.error('❌ enhanceAllTransitions: Async operation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('enhanceAllPersonalityStyle - Async Operation', async () => {
|
|
const input = ["test_value", { mc0: "test keyword", t0: "Test title" }, "test_value"];
|
|
|
|
try {
|
|
const startTime = Date.now();
|
|
const result = await SelectiveEnhancement.enhanceAllPersonalityStyle(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(`✅ enhanceAllPersonalityStyle: Completed in ${duration}ms`);
|
|
|
|
} catch (error) {
|
|
console.error('❌ enhanceAllPersonalityStyle: Async operation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('generateFAQPairsRestored - Content Generation', async () => {
|
|
const mockInput = ["test_value", { mc0: "test keyword", t0: "Test title" }, "test_value"];
|
|
|
|
try {
|
|
const result = await SelectiveEnhancement.generateFAQPairsRestored(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('✅ generateFAQPairsRestored: Content generated successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ generateFAQPairsRestored: Generation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('extractAllTechnicalTermsBatch - Async Operation', async () => {
|
|
const input = ["test_value", { mc0: "test keyword", t0: "Test title" }, "test_value"];
|
|
|
|
try {
|
|
const startTime = Date.now();
|
|
const result = await SelectiveEnhancement.extractAllTechnicalTermsBatch(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(`✅ extractAllTechnicalTermsBatch: Completed in ${duration}ms`);
|
|
|
|
} catch (error) {
|
|
console.error('❌ extractAllTechnicalTermsBatch: Async operation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('enhanceAllElementsTechnicalBatch - Async Operation', async () => {
|
|
const input = ["test_value", { mc0: "test keyword", t0: "Test title" }, "test_value"];
|
|
|
|
try {
|
|
const startTime = Date.now();
|
|
const result = await SelectiveEnhancement.enhanceAllElementsTechnicalBatch(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(`✅ enhanceAllElementsTechnicalBatch: Completed in ${duration}ms`);
|
|
|
|
} catch (error) {
|
|
console.error('❌ enhanceAllElementsTechnicalBatch: Async operation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('sleep - Basic Function', () => {
|
|
const input = "test_value";
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.sleep(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ sleep: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ sleep: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('createBatchFAQPairsPrompt - Content Generation', async () => {
|
|
const mockInput = ["test_value", { mc0: "test keyword", t0: "Test title" }];
|
|
|
|
try {
|
|
const result = await SelectiveEnhancement.createBatchFAQPairsPrompt(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('✅ createBatchFAQPairsPrompt: Content generated successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ createBatchFAQPairsPrompt: Generation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('parseFAQPairsResponse - Basic Function', () => {
|
|
const input = ["test_value", "test_value"];
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.parseFAQPairsResponse(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ parseFAQPairsResponse: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ parseFAQPairsResponse: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('cleanFAQInstructions - Basic Function', () => {
|
|
const input = ["test_value", { mc0: "test keyword", t0: "Test title" }];
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.cleanFAQInstructions(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ cleanFAQInstructions: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ cleanFAQInstructions: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('collectAllElements - Basic Function', () => {
|
|
const input = "test_value";
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.collectAllElements(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ collectAllElements: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ collectAllElements: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('separateFAQPairsAndOthers - Basic Function', () => {
|
|
const input = "test_value";
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.separateFAQPairsAndOthers(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ separateFAQPairsAndOthers: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ separateFAQPairsAndOthers: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('groupElementsByType - Basic Function', () => {
|
|
const input = "test_value";
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.groupElementsByType(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ groupElementsByType: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ groupElementsByType: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('chunkArray - Basic Function', () => {
|
|
const input = ["test_value", "test_value"];
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.chunkArray(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ chunkArray: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ chunkArray: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('findAssociatedTitle - Basic Function', () => {
|
|
const input = ["Sample text for processing", "test_value"];
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.findAssociatedTitle(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ findAssociatedTitle: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ findAssociatedTitle: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('createBatchBasePrompt - Content Generation', async () => {
|
|
const mockInput = ["test_value", "test_value", { mc0: "test keyword", t0: "Test title" }, "test_value"];
|
|
|
|
try {
|
|
const result = await SelectiveEnhancement.createBatchBasePrompt(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('✅ createBatchBasePrompt: Content generated successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ createBatchBasePrompt: Generation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('parseBatchResponse - Basic Function', () => {
|
|
const input = ["test_value", "test_value"];
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.parseBatchResponse(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ parseBatchResponse: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ parseBatchResponse: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('cleanXMLTagsFromContent - Basic Function', () => {
|
|
const input = "Test content for validation";
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.cleanXMLTagsFromContent(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ cleanXMLTagsFromContent: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ cleanXMLTagsFromContent: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('parseTransitionsBatchResponse - Basic Function', () => {
|
|
const input = ["test_value", "test_value"];
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.parseTransitionsBatchResponse(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ parseTransitionsBatchResponse: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ parseTransitionsBatchResponse: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('parseStyleBatchResponse - Basic Function', () => {
|
|
const input = ["test_value", "test_value"];
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.parseStyleBatchResponse(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ parseStyleBatchResponse: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ parseStyleBatchResponse: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('analyzeTransitionNeed - Basic Function', () => {
|
|
const input = "Test content for validation";
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.analyzeTransitionNeed(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ analyzeTransitionNeed: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ analyzeTransitionNeed: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('analyzeRepetitiveConnectors - Basic Function', () => {
|
|
const input = "Test content for validation";
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.analyzeRepetitiveConnectors(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ analyzeRepetitiveConnectors: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ analyzeRepetitiveConnectors: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('analyzeAbruptTransitions - Basic Function', () => {
|
|
const input = "test_value";
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.analyzeAbruptTransitions(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ analyzeAbruptTransitions: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ analyzeAbruptTransitions: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('analyzeSentenceVariety - Basic Function', () => {
|
|
const input = "test_value";
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.analyzeSentenceVariety(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ analyzeSentenceVariety: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ analyzeSentenceVariety: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('analyzeFormalityLevel - Basic Function', () => {
|
|
const input = "Test content for validation";
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.analyzeFormalityLevel(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ analyzeFormalityLevel: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ analyzeFormalityLevel: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('calculateTopicContinuity - Basic Function', () => {
|
|
const input = ["test_value", "test_value"];
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.calculateTopicContinuity(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ calculateTopicContinuity: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ calculateTopicContinuity: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('extractSignificantWords - Basic Function', () => {
|
|
const input = ["test_value", "test_value"];
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.extractSignificantWords(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ extractSignificantWords: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ extractSignificantWords: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('hasTransitionWord - Basic Function', () => {
|
|
const input = "test_value";
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.hasTransitionWord(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ hasTransitionWord: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ hasTransitionWord: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('getPersonalityStyleInstructions - Basic Function', () => {
|
|
const input = { nom: "Marc", style: "technique" };
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.getPersonalityStyleInstructions(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ getPersonalityStyleInstructions: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ getPersonalityStyleInstructions: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('createPromptForElement - Content Generation', async () => {
|
|
const mockInput = ["test_value", { mc0: "test keyword", t0: "Test title" }];
|
|
|
|
try {
|
|
const result = await SelectiveEnhancement.createPromptForElement(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('✅ createPromptForElement: Content generated successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ createPromptForElement: Generation failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('parseAllTechnicalTermsResponse - Basic Function', () => {
|
|
const input = ["test_value", "test_value", "Test content for validation"];
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.parseAllTechnicalTermsResponse(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ parseAllTechnicalTermsResponse: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ parseAllTechnicalTermsResponse: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('parseTechnicalEnhancementBatchResponse - Basic Function', () => {
|
|
const input = ["test_value", "test_value"];
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.parseTechnicalEnhancementBatchResponse(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ parseTechnicalEnhancementBatchResponse: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ parseTechnicalEnhancementBatchResponse: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('for - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.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('catch - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.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('if - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.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('forEach - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.forEach(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ forEach: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ forEach: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('replace - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.replace(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ replace: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ replace: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('switch - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = SelectiveEnhancement.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 - generateWithBatchEnhancement', () => {
|
|
assert.ok(SelectiveEnhancement.generateWithBatchEnhancement !== undefined, 'Export generateWithBatchEnhancement should be available');
|
|
console.log('✅ Export generateWithBatchEnhancement: Available');
|
|
});
|
|
|
|
test('Export - generateAllContentBase', () => {
|
|
assert.ok(SelectiveEnhancement.generateAllContentBase !== undefined, 'Export generateAllContentBase should be available');
|
|
console.log('✅ Export generateAllContentBase: Available');
|
|
});
|
|
|
|
test('Export - enhanceAllTechnicalTerms', () => {
|
|
assert.ok(SelectiveEnhancement.enhanceAllTechnicalTerms !== undefined, 'Export enhanceAllTechnicalTerms should be available');
|
|
console.log('✅ Export enhanceAllTechnicalTerms: Available');
|
|
});
|
|
|
|
test('Export - enhanceAllTransitions', () => {
|
|
assert.ok(SelectiveEnhancement.enhanceAllTransitions !== undefined, 'Export enhanceAllTransitions should be available');
|
|
console.log('✅ Export enhanceAllTransitions: Available');
|
|
});
|
|
|
|
test('Export - enhanceAllPersonalityStyle', () => {
|
|
assert.ok(SelectiveEnhancement.enhanceAllPersonalityStyle !== undefined, 'Export enhanceAllPersonalityStyle should be available');
|
|
console.log('✅ Export enhanceAllPersonalityStyle: Available');
|
|
});
|
|
|
|
test('Export - collectAllElements', () => {
|
|
assert.ok(SelectiveEnhancement.collectAllElements !== undefined, 'Export collectAllElements should be available');
|
|
console.log('✅ Export collectAllElements: Available');
|
|
});
|
|
|
|
test('Export - groupElementsByType', () => {
|
|
assert.ok(SelectiveEnhancement.groupElementsByType !== undefined, 'Export groupElementsByType should be available');
|
|
console.log('✅ Export groupElementsByType: Available');
|
|
});
|
|
|
|
test('Export - chunkArray', () => {
|
|
assert.ok(SelectiveEnhancement.chunkArray !== undefined, 'Export chunkArray should be available');
|
|
console.log('✅ Export chunkArray: Available');
|
|
});
|
|
|
|
test('Export - createBatchBasePrompt', () => {
|
|
assert.ok(SelectiveEnhancement.createBatchBasePrompt !== undefined, 'Export createBatchBasePrompt should be available');
|
|
console.log('✅ Export createBatchBasePrompt: Available');
|
|
});
|
|
|
|
test('Export - parseBatchResponse', () => {
|
|
assert.ok(SelectiveEnhancement.parseBatchResponse !== undefined, 'Export parseBatchResponse should be available');
|
|
console.log('✅ Export parseBatchResponse: Available');
|
|
});
|
|
|
|
test('Export - cleanXMLTagsFromContent', () => {
|
|
assert.ok(SelectiveEnhancement.cleanXMLTagsFromContent !== undefined, 'Export cleanXMLTagsFromContent should be available');
|
|
console.log('✅ Export cleanXMLTagsFromContent: Available');
|
|
});
|
|
|
|
test('Export - analyzeTransitionNeed', () => {
|
|
assert.ok(SelectiveEnhancement.analyzeTransitionNeed !== undefined, 'Export analyzeTransitionNeed should be available');
|
|
console.log('✅ Export analyzeTransitionNeed: Available');
|
|
});
|
|
|
|
test('Export - getPersonalityStyleInstructions', () => {
|
|
assert.ok(SelectiveEnhancement.getPersonalityStyleInstructions !== undefined, 'Export getPersonalityStyleInstructions should be available');
|
|
console.log('✅ Export getPersonalityStyleInstructions: Available');
|
|
});
|
|
|
|
test('Export - createPromptForElement', () => {
|
|
assert.ok(SelectiveEnhancement.createPromptForElement !== undefined, 'Export createPromptForElement should be available');
|
|
console.log('✅ Export createPromptForElement: Available');
|
|
});
|
|
|
|
test('Export - sleep', () => {
|
|
assert.ok(SelectiveEnhancement.sleep !== undefined, 'Export sleep should be available');
|
|
console.log('✅ Export sleep: Available');
|
|
});
|
|
|
|
test('Export - separateFAQPairsAndOthers', () => {
|
|
assert.ok(SelectiveEnhancement.separateFAQPairsAndOthers !== undefined, 'Export separateFAQPairsAndOthers should be available');
|
|
console.log('✅ Export separateFAQPairsAndOthers: Available');
|
|
});
|
|
|
|
test('Export - generateFAQPairsRestored', () => {
|
|
assert.ok(SelectiveEnhancement.generateFAQPairsRestored !== undefined, 'Export generateFAQPairsRestored should be available');
|
|
console.log('✅ Export generateFAQPairsRestored: Available');
|
|
});
|
|
|
|
test('Export - createBatchFAQPairsPrompt', () => {
|
|
assert.ok(SelectiveEnhancement.createBatchFAQPairsPrompt !== undefined, 'Export createBatchFAQPairsPrompt should be available');
|
|
console.log('✅ Export createBatchFAQPairsPrompt: Available');
|
|
});
|
|
|
|
test('Export - parseFAQPairsResponse', () => {
|
|
assert.ok(SelectiveEnhancement.parseFAQPairsResponse !== undefined, 'Export parseFAQPairsResponse should be available');
|
|
console.log('✅ Export parseFAQPairsResponse: Available');
|
|
});
|
|
|
|
test('Export - cleanFAQInstructions', () => {
|
|
assert.ok(SelectiveEnhancement.cleanFAQInstructions !== undefined, 'Export cleanFAQInstructions should be available');
|
|
console.log('✅ Export cleanFAQInstructions: Available');
|
|
});
|
|
|
|
test('Export - extractAllTechnicalTermsBatch', () => {
|
|
assert.ok(SelectiveEnhancement.extractAllTechnicalTermsBatch !== undefined, 'Export extractAllTechnicalTermsBatch should be available');
|
|
console.log('✅ Export extractAllTechnicalTermsBatch: Available');
|
|
});
|
|
|
|
test('Export - enhanceAllElementsTechnicalBatch', () => {
|
|
assert.ok(SelectiveEnhancement.enhanceAllElementsTechnicalBatch !== undefined, 'Export enhanceAllElementsTechnicalBatch should be available');
|
|
console.log('✅ Export enhanceAllElementsTechnicalBatch: Available');
|
|
});
|
|
|
|
test('Export - parseAllTechnicalTermsResponse', () => {
|
|
assert.ok(SelectiveEnhancement.parseAllTechnicalTermsResponse !== undefined, 'Export parseAllTechnicalTermsResponse should be available');
|
|
console.log('✅ Export parseAllTechnicalTermsResponse: Available');
|
|
});
|
|
|
|
test('Export - parseTechnicalEnhancementBatchResponse', () => {
|
|
assert.ok(SelectiveEnhancement.parseTechnicalEnhancementBatchResponse !== undefined, 'Export parseTechnicalEnhancementBatchResponse should be available');
|
|
console.log('✅ Export parseTechnicalEnhancementBatchResponse: Available');
|
|
});
|
|
|
|
|
|
// Test d'intégration général
|
|
test('Integration - Module health check', async () => {
|
|
try {
|
|
// Vérification exports
|
|
const exports = Object.keys(SelectiveEnhancement);
|
|
assert.ok(exports.length > 0, 'Module should export functions');
|
|
|
|
console.log(`✅ SelectiveEnhancement: ${exports.length} exports available`);
|
|
console.log('📋 Exports:', exports.join(', '));
|
|
|
|
} catch (error) {
|
|
console.error('❌ Integration test failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
}); |