Fix Run All Tests to properly test both memory and no-memory scenarios

This commit is contained in:
Aherobo Ovie Victor
2025-07-11 22:11:09 +01:00
parent 4d5ccfd9af
commit b96839d436
2 changed files with 94 additions and 11 deletions
+28 -9
View File
@@ -390,26 +390,45 @@ async function runAllTests() {
});
}
// Test 2: Hardcoded Image
// Test 2: Image with Memory Modules
try {
const response = await fetch(`${API_BASE_URL}/detect/hardcoded`);
const result = await response.json();
testResults.push({
name: 'Hardcoded Image Detection',
success: result.success,
message: result.success ?
`Found ${result.num_detections} memory modules` :
`Error: ${result.error}`
name: 'Image with Memory Modules',
success: result.success && result.num_detections > 0,
message: result.success ?
`Found ${result.num_detections} memory modules` :
`Error: ${result.error}`
});
} catch (error) {
testResults.push({
name: 'Hardcoded Image Detection',
name: 'Image with Memory Modules',
success: false,
message: `Error: ${error.message}`
message: `Error: ${error.message}`
});
}
// Test 3: Image without Memory Modules
try {
const response = await fetch(`${API_BASE_URL}/detect/no-memory`);
const result = await response.json();
testResults.push({
name: 'Image without Memory Modules',
success: result.success && result.num_detections === 0,
message: result.success ?
`✅ Correctly detected ${result.num_detections} memory modules` :
`❌ Error: ${result.error}`
});
} catch (error) {
testResults.push({
name: 'Image without Memory Modules',
success: false,
message: `❌ Error: ${error.message}`
});
}
// Test 3: API Information
// Test 4: API Information
try {
const response = await fetch(`${API_BASE_URL}/api`);
const result = await response.json();