245 lines
8.6 KiB
JavaScript
245 lines
8.6 KiB
JavaScript
// ========================================
|
|
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - NaturalConnectors
|
|
// Module: pattern-breaking/NaturalConnectors.js
|
|
// Générés le: 2025-09-08T23:48:03.047Z
|
|
// ========================================
|
|
|
|
const assert = require('assert');
|
|
const { test, describe } = require('node:test');
|
|
const NaturalConnectors = require('../../pattern-breaking/NaturalConnectors.js');
|
|
|
|
describe('NaturalConnectors - Tests automatiques', () => {
|
|
|
|
// Setup avant les tests
|
|
let testContext = {};
|
|
|
|
test('Module loading', () => {
|
|
assert.ok(NaturalConnectors, 'Module should be loaded');
|
|
console.log('📦 Module NaturalConnectors loaded successfully');
|
|
});
|
|
|
|
|
|
test('humanizeTransitions - Basic Function', () => {
|
|
const input = ["Sample text for processing", { test: true }];
|
|
|
|
try {
|
|
const result = NaturalConnectors.humanizeTransitions(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ humanizeTransitions: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ humanizeTransitions: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('replaceFormalConnectors - Basic Function', () => {
|
|
const input = ["Sample text for processing", "test_value"];
|
|
|
|
try {
|
|
const result = NaturalConnectors.replaceFormalConnectors(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ replaceFormalConnectors: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ replaceFormalConnectors: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('humanizeFormalStarts - Basic Function', () => {
|
|
const input = ["Sample text for processing", "test_value"];
|
|
|
|
try {
|
|
const result = NaturalConnectors.humanizeFormalStarts(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ humanizeFormalStarts: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ humanizeFormalStarts: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('replaceArtificialTransitions - Basic Function', () => {
|
|
const input = ["Sample text for processing", "test_value"];
|
|
|
|
try {
|
|
const result = NaturalConnectors.replaceArtificialTransitions(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ replaceArtificialTransitions: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ replaceArtificialTransitions: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('addContextualVariability - Basic Function', () => {
|
|
const input = ["Sample text for processing", "test_value"];
|
|
|
|
try {
|
|
const result = NaturalConnectors.addContextualVariability(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ addContextualVariability: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ addContextualVariability: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('detectFormalConnectors - Basic Function', () => {
|
|
const input = "Sample text for processing";
|
|
|
|
try {
|
|
const result = NaturalConnectors.detectFormalConnectors(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ detectFormalConnectors: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ detectFormalConnectors: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('analyzeConnectorFormality - Basic Function', () => {
|
|
const input = "Sample text for processing";
|
|
|
|
try {
|
|
const result = NaturalConnectors.analyzeConnectorFormality(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ analyzeConnectorFormality: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ analyzeConnectorFormality: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('if - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = NaturalConnectors.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 = NaturalConnectors.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('Export - humanizeTransitions', () => {
|
|
assert.ok(NaturalConnectors.humanizeTransitions !== undefined, 'Export humanizeTransitions should be available');
|
|
console.log('✅ Export humanizeTransitions: Available');
|
|
});
|
|
|
|
test('Export - replaceFormalConnectors', () => {
|
|
assert.ok(NaturalConnectors.replaceFormalConnectors !== undefined, 'Export replaceFormalConnectors should be available');
|
|
console.log('✅ Export replaceFormalConnectors: Available');
|
|
});
|
|
|
|
test('Export - humanizeFormalStarts', () => {
|
|
assert.ok(NaturalConnectors.humanizeFormalStarts !== undefined, 'Export humanizeFormalStarts should be available');
|
|
console.log('✅ Export humanizeFormalStarts: Available');
|
|
});
|
|
|
|
test('Export - replaceArtificialTransitions', () => {
|
|
assert.ok(NaturalConnectors.replaceArtificialTransitions !== undefined, 'Export replaceArtificialTransitions should be available');
|
|
console.log('✅ Export replaceArtificialTransitions: Available');
|
|
});
|
|
|
|
test('Export - addContextualVariability', () => {
|
|
assert.ok(NaturalConnectors.addContextualVariability !== undefined, 'Export addContextualVariability should be available');
|
|
console.log('✅ Export addContextualVariability: Available');
|
|
});
|
|
|
|
test('Export - detectFormalConnectors', () => {
|
|
assert.ok(NaturalConnectors.detectFormalConnectors !== undefined, 'Export detectFormalConnectors should be available');
|
|
console.log('✅ Export detectFormalConnectors: Available');
|
|
});
|
|
|
|
test('Export - analyzeConnectorFormality', () => {
|
|
assert.ok(NaturalConnectors.analyzeConnectorFormality !== undefined, 'Export analyzeConnectorFormality should be available');
|
|
console.log('✅ Export analyzeConnectorFormality: Available');
|
|
});
|
|
|
|
test('Export - FORMAL_CONNECTORS', () => {
|
|
assert.ok(NaturalConnectors.FORMAL_CONNECTORS !== undefined, 'Export FORMAL_CONNECTORS should be available');
|
|
console.log('✅ Export FORMAL_CONNECTORS: Available');
|
|
});
|
|
|
|
test('Export - NATURAL_CONNECTORS_BY_CONTEXT', () => {
|
|
assert.ok(NaturalConnectors.NATURAL_CONNECTORS_BY_CONTEXT !== undefined, 'Export NATURAL_CONNECTORS_BY_CONTEXT should be available');
|
|
console.log('✅ Export NATURAL_CONNECTORS_BY_CONTEXT: Available');
|
|
});
|
|
|
|
|
|
// Test d'intégration général
|
|
test('Integration - Module health check', async () => {
|
|
try {
|
|
// Vérification exports
|
|
const exports = Object.keys(NaturalConnectors);
|
|
assert.ok(exports.length > 0, 'Module should export functions');
|
|
|
|
console.log(`✅ NaturalConnectors: ${exports.length} exports available`);
|
|
console.log('📋 Exports:', exports.join(', '));
|
|
|
|
} catch (error) {
|
|
console.error('❌ Integration test failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
}); |