/**
* Test for Command Interface Standardization
* Part of Phase 4c Implementation
*/
import { processCommand, validateCommand, StandardParams } from './commandHandler.js';
import { Loggers } from './utils/logger.js';
const logger = Loggers.server;
logger.info('===== TESTING COMMAND INTERFACE STANDARDIZATION =====');
// Test help command
try {
logger.info('Testing help command');
const result = processCommand({
command: {
type: 'help'
}
});
logger.info('Help command result', { result });
} catch (error) {
logger.error('Error in help command', { error: error instanceof Error ? error.message : String(error) });
}
// Test help with specific topic
try {
logger.info('Testing help with topic');
const result = processCommand({
command: {
type: 'help',
parameters: {
topic: 'mathematical'
}
}
});
logger.info('Help with topic result', { result });
} catch (error) {
logger.error('Error in help with topic', { error: error instanceof Error ? error.message : String(error) });
}
// Test listSystems command
try {
logger.info('Testing listSystems command');
const result = processCommand({
command: {
type: 'listSystems'
}
});
logger.info('ListSystems result', { result });
} catch (error) {
logger.error('Error in listSystems', { error: error instanceof Error ? error.message : String(error) });
}
// Test listOperations command
try {
logger.info('Testing listOperations command');
const result = processCommand({
command: {
type: 'listOperations'
}
});
logger.info('ListOperations result', { result });
} catch (error) {
logger.error('Error in listOperations', { error: error instanceof Error ? error.message : String(error) });
}
// Test listFallacies command
try {
logger.info('Testing listFallacies command');
const result = processCommand({
command: {
type: 'listFallacies',
parameters: {
system: 'propositional'
}
}
});
logger.info('ListFallacies result', { result });
} catch (error) {
logger.error('Error in listFallacies', { error: error instanceof Error ? error.message : String(error) });
}
// Test showExamples command
try {
logger.info('Testing showExamples command');
const result = processCommand({
command: {
type: 'showExamples',
parameters: {
system: 'mathematical',
operation: 'solve'
}
}
});
logger.info('ShowExamples result', { result });
} catch (error) {
logger.error('Error in showExamples', { error: error instanceof Error ? error.message : String(error) });
}
// Test invalid command
try {
logger.info('Testing invalid command');
const result = processCommand({
command: {
type: 'invalidCommand'
} as any
});
logger.info('Invalid command result', { result });
} catch (error) {
logger.error('Error in invalid command test', { error: error instanceof Error ? error.message : String(error) });
}
// Test similar command suggestion
try {
logger.info('Testing command suggestion');
const validation = validateCommand({
type: 'hlp' as any // Misspelled 'help'
});
logger.info('Validation result', { validation });
} catch (error) {
logger.error('Error in command suggestion test', { error: error instanceof Error ? error.message : String(error) });
}
logger.info('===== COMMAND INTERFACE STANDARDIZATION TEST COMPLETE =====');