- Remove internal/parser package and all legacy ID generation logic - Update enhancer and auto_enhancer to use unified engine functions - Migrate utility functions (FindViableChildren, HasEditableContent) to engine - Create stub enhancer implementation that uses unified engine architecture - Ensure all enhancement workflows now go through single unified system - Remove parser dependencies and consolidate content processing logic This completes the cleanup phase - all components now use unified engine instead of fragmented ID generation systems.
69 lines
1.8 KiB
Bash
Executable File
69 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Test script for unified content engine architecture
|
|
echo "🔧 Testing Unified Content Engine Architecture"
|
|
echo
|
|
|
|
# Test data
|
|
HTML_MARKUP='<h2 class="hero-title">Welcome to Our Site</h2>'
|
|
SITE_ID="demo"
|
|
FILE_PATH="index.html"
|
|
CONTENT_VALUE="Welcome to Our Amazing Website"
|
|
CONTENT_TYPE="text"
|
|
|
|
echo "📝 Test Data:"
|
|
echo " HTML Markup: $HTML_MARKUP"
|
|
echo " Site ID: $SITE_ID"
|
|
echo " File Path: $FILE_PATH"
|
|
echo " Content: $CONTENT_VALUE"
|
|
echo
|
|
|
|
# Create JSON payload
|
|
JSON_PAYLOAD=$(cat <<EOF
|
|
{
|
|
"html_markup": "$HTML_MARKUP",
|
|
"file_path": "$FILE_PATH",
|
|
"site_id": "$SITE_ID",
|
|
"value": "$CONTENT_VALUE",
|
|
"type": "$CONTENT_TYPE"
|
|
}
|
|
EOF
|
|
)
|
|
|
|
echo "🌐 Testing API endpoint..."
|
|
echo "POST http://localhost:8080/api/content"
|
|
echo
|
|
|
|
# Test the API
|
|
RESPONSE=$(curl -s -X POST \
|
|
http://localhost:8080/api/content \
|
|
-H "Content-Type: application/json" \
|
|
-H "Authorization: Bearer mock-token" \
|
|
-d "$JSON_PAYLOAD" 2>/dev/null)
|
|
|
|
if [ $? -eq 0 ] && [ -n "$RESPONSE" ]; then
|
|
echo "✅ API Response:"
|
|
echo "$RESPONSE" | jq '.' 2>/dev/null || echo "$RESPONSE"
|
|
echo
|
|
|
|
# Extract ID from response if possible
|
|
CONTENT_ID=$(echo "$RESPONSE" | jq -r '.id' 2>/dev/null)
|
|
if [ "$CONTENT_ID" != "null" ] && [ -n "$CONTENT_ID" ]; then
|
|
echo "🎯 Generated Content ID: $CONTENT_ID"
|
|
echo
|
|
|
|
# Test retrieval
|
|
echo "🔍 Testing content retrieval..."
|
|
GET_RESPONSE=$(curl -s "http://localhost:8080/api/content/$CONTENT_ID?site_id=$SITE_ID" 2>/dev/null)
|
|
echo "GET Response:"
|
|
echo "$GET_RESPONSE" | jq '.' 2>/dev/null || echo "$GET_RESPONSE"
|
|
fi
|
|
else
|
|
echo "❌ API Request Failed or Server Not Running"
|
|
echo "Response: $RESPONSE"
|
|
echo
|
|
echo "💡 Start the server with: just dev"
|
|
fi
|
|
|
|
echo
|
|
echo "🏁 Test Complete" |