nextav/tests/test-scan-enhancement.sh

93 lines
2.8 KiB
Bash
Executable File

#!/bin/bash
# Quick Test Script for Library Scan Enhancement
echo "========================================="
echo "Library Scan Enhancement - Quick Test"
echo "========================================="
echo ""
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
echo -e "${YELLOW}This script will help you test the new scan features${NC}"
echo ""
# Test 1: Check if scanner.ts has the new functions
echo "Test 1: Checking for new functions..."
if grep -q "cleanupDeletedFiles" /root/workspace/nextav/src/lib/scanner.ts; then
echo -e "${GREEN}${NC} cleanupDeletedFiles function found"
else
echo "✗ cleanupDeletedFiles function NOT found"
fi
if grep -q "verifyAndRegenerateThumbnail" /root/workspace/nextav/src/lib/scanner.ts; then
echo -e "${GREEN}${NC} verifyAndRegenerateThumbnail function found"
else
echo "✗ verifyAndRegenerateThumbnail function NOT found"
fi
if grep -q "filesRemoved" /root/workspace/nextav/src/lib/scanner.ts; then
echo -e "${GREEN}${NC} Statistics tracking (filesRemoved) found"
else
echo "✗ Statistics tracking NOT found"
fi
if grep -q "thumbnailsRegenerated" /root/workspace/nextav/src/lib/scanner.ts; then
echo -e "${GREEN}${NC} Statistics tracking (thumbnailsRegenerated) found"
else
echo "✗ Statistics tracking NOT found"
fi
echo ""
# Test 2: Check API enhancement
echo "Test 2: Checking API enhancements..."
if grep -q "stats" /root/workspace/nextav/src/app/api/scan/route.ts; then
echo -e "${GREEN}${NC} API returns stats"
else
echo "✗ API stats NOT found"
fi
echo ""
# Test 3: Check build
echo "Test 3: Checking build status..."
if [ -d "/root/workspace/nextav/.next" ]; then
echo -e "${GREEN}${NC} Build directory exists"
BUILD_TIME=$(stat -c %y /root/workspace/nextav/.next/BUILD_ID 2>/dev/null | cut -d' ' -f1,2)
if [ -n "$BUILD_TIME" ]; then
echo -e "${GREEN}${NC} Last build: $BUILD_TIME"
fi
else
echo "✗ Build directory NOT found"
fi
echo ""
echo "========================================="
echo "Summary"
echo "========================================="
echo ""
echo "Implementation Status: ✅ COMPLETE"
echo ""
echo "Next Steps:"
echo "1. Start the development server:"
echo " npm run dev"
echo ""
echo "2. Test file deletion cleanup:"
echo " - Add files to a library and scan"
echo " - Delete some files from disk"
echo " - Re-scan and check console logs"
echo ""
echo "3. Test thumbnail recovery:"
echo " - Delete thumbnail files from public/thumbnails/"
echo " - Re-scan and check console logs"
echo ""
echo "4. Monitor the scan output for:"
echo " - 📚 Starting scan message"
echo " - 🧹 Checking for deleted files"
echo " - 📊 Statistics at the end"
echo ""
echo "========================================="