240 lines
8.0 KiB
JavaScript
240 lines
8.0 KiB
JavaScript
// ========================================
|
|
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - FatiguePatterns
|
|
// Module: human-simulation/FatiguePatterns.js
|
|
// Générés le: 2025-09-06T12:40:36.100Z
|
|
// ========================================
|
|
|
|
const assert = require('assert');
|
|
const { test, describe } = require('node:test');
|
|
const FatiguePatterns = require('../../human-simulation/FatiguePatterns.js');
|
|
|
|
describe('FatiguePatterns - Tests automatiques', () => {
|
|
|
|
// Setup avant les tests
|
|
let testContext = {};
|
|
|
|
test('Module loading', () => {
|
|
assert.ok(FatiguePatterns, 'Module should be loaded');
|
|
console.log('📦 Module FatiguePatterns loaded successfully');
|
|
});
|
|
|
|
|
|
test('calculateFatigue - Basic Function', () => {
|
|
const input = ["test_value", "test_value"];
|
|
|
|
try {
|
|
const result = FatiguePatterns.calculateFatigue(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ calculateFatigue: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ calculateFatigue: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('getFatigueProfile - Basic Function', () => {
|
|
const input = { nom: "Marc", style: "technique" };
|
|
|
|
try {
|
|
const result = FatiguePatterns.getFatigueProfile(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ getFatigueProfile: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ getFatigueProfile: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('injectFatigueMarkers - Basic Function', () => {
|
|
const input = ["Test content for validation", "test_value", { test: true }];
|
|
|
|
try {
|
|
const result = FatiguePatterns.injectFatigueMarkers(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ injectFatigueMarkers: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ injectFatigueMarkers: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('applyLightFatigue - Basic Function', () => {
|
|
const input = ["Test content for validation", "test_value"];
|
|
|
|
try {
|
|
const result = FatiguePatterns.applyLightFatigue(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ applyLightFatigue: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ applyLightFatigue: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('applyModerateFatigue - Basic Function', () => {
|
|
const input = ["Test content for validation", "test_value"];
|
|
|
|
try {
|
|
const result = FatiguePatterns.applyModerateFatigue(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ applyModerateFatigue: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ applyModerateFatigue: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('applyHeavyFatigue - Basic Function', () => {
|
|
const input = ["Test content for validation", "test_value"];
|
|
|
|
try {
|
|
const result = FatiguePatterns.applyHeavyFatigue(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ applyHeavyFatigue: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ applyHeavyFatigue: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('applyFatigueRecovery - Basic Function', () => {
|
|
const input = ["Test content for validation", "test_value"];
|
|
|
|
try {
|
|
const result = FatiguePatterns.applyFatigueRecovery(input);
|
|
|
|
// Validations de base
|
|
assert.ok(result !== undefined, 'Should return a result');
|
|
assert.ok(typeof result !== 'undefined', 'Result should be defined');
|
|
|
|
console.log('✅ applyFatigueRecovery: Function executed successfully');
|
|
|
|
} catch (error) {
|
|
console.error('❌ applyFatigueRecovery: Function failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
test('if - Basic Function', () => {
|
|
const input = undefined;
|
|
|
|
try {
|
|
const result = FatiguePatterns.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 = FatiguePatterns.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 - calculateFatigue', () => {
|
|
assert.ok(FatiguePatterns.calculateFatigue !== undefined, 'Export calculateFatigue should be available');
|
|
console.log('✅ Export calculateFatigue: Available');
|
|
});
|
|
|
|
test('Export - getFatigueProfile', () => {
|
|
assert.ok(FatiguePatterns.getFatigueProfile !== undefined, 'Export getFatigueProfile should be available');
|
|
console.log('✅ Export getFatigueProfile: Available');
|
|
});
|
|
|
|
test('Export - injectFatigueMarkers', () => {
|
|
assert.ok(FatiguePatterns.injectFatigueMarkers !== undefined, 'Export injectFatigueMarkers should be available');
|
|
console.log('✅ Export injectFatigueMarkers: Available');
|
|
});
|
|
|
|
test('Export - applyLightFatigue', () => {
|
|
assert.ok(FatiguePatterns.applyLightFatigue !== undefined, 'Export applyLightFatigue should be available');
|
|
console.log('✅ Export applyLightFatigue: Available');
|
|
});
|
|
|
|
test('Export - applyModerateFatigue', () => {
|
|
assert.ok(FatiguePatterns.applyModerateFatigue !== undefined, 'Export applyModerateFatigue should be available');
|
|
console.log('✅ Export applyModerateFatigue: Available');
|
|
});
|
|
|
|
test('Export - applyHeavyFatigue', () => {
|
|
assert.ok(FatiguePatterns.applyHeavyFatigue !== undefined, 'Export applyHeavyFatigue should be available');
|
|
console.log('✅ Export applyHeavyFatigue: Available');
|
|
});
|
|
|
|
test('Export - applyFatigueRecovery', () => {
|
|
assert.ok(FatiguePatterns.applyFatigueRecovery !== undefined, 'Export applyFatigueRecovery should be available');
|
|
console.log('✅ Export applyFatigueRecovery: Available');
|
|
});
|
|
|
|
test('Export - FATIGUE_PROFILES', () => {
|
|
assert.ok(FatiguePatterns.FATIGUE_PROFILES !== undefined, 'Export FATIGUE_PROFILES should be available');
|
|
console.log('✅ Export FATIGUE_PROFILES: Available');
|
|
});
|
|
|
|
|
|
// Test d'intégration général
|
|
test('Integration - Module health check', async () => {
|
|
try {
|
|
// Vérification exports
|
|
const exports = Object.keys(FatiguePatterns);
|
|
assert.ok(exports.length > 0, 'Module should export functions');
|
|
|
|
console.log(`✅ FatiguePatterns: ${exports.length} exports available`);
|
|
console.log('📋 Exports:', exports.join(', '));
|
|
|
|
} catch (error) {
|
|
console.error('❌ Integration test failed:', error.message);
|
|
throw error;
|
|
}
|
|
});
|
|
}); |