mono/packages/media/tests/salamander-test.sh
2025-08-11 17:19:38 +02:00

92 lines
2.6 KiB
Bash

echo "=== Salamander Menu Test Script ==="
echo "Testing Salamander menu generation functionality"
echo
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Create test output directory
mkdir -p tests/salamander-test-output
echo -e "${BLUE}Building project...${NC}"
npm run build
echo
echo -e "${BLUE}Test 1: Generate menu from sample JSON${NC}"
pm-media salamander \
--config "integration/salamander-menu-sample.json" \
--output "tests/salamander-test-output/sample-menu.reg" \
--verbose
echo -e "${GREEN}✓ Sample menu generation completed${NC}"
echo
echo -e "${BLUE}Test 2: Auto-detect insertion point from existing registry${NC}"
pm-media salamander \
--config "integration/salamander-menu-sample.json" \
--output "tests/salamander-test-output/auto-detect-menu.reg" \
--existing "src/ref/config_sal_min.reg" \
--verbose
echo -e "${GREEN}✓ Auto-detect insertion test completed${NC}"
echo
echo -e "${BLUE}Test 3: Insert into existing Media group${NC}"
pm-media salamander \
--config "integration/salamander-menu-sample.json" \
--output "tests/salamander-test-output/media-group-menu.reg" \
--existing "src/ref/config_sal_min.reg" \
--group "Media" \
--verbose
echo -e "${GREEN}✓ Media group insertion test completed${NC}"
echo
echo -e "${BLUE}Test 4: Custom start index${NC}"
pm-media salamander \
--config "integration/salamander-menu-sample.json" \
--output "tests/salamander-test-output/custom-index-menu.reg" \
--startIndex 10 \
--verbose
echo -e "${GREEN}✓ Custom start index test completed${NC}"
echo
echo -e "${BLUE}Test 5: Help and usage${NC}"
pm-media salamander --help | head -15
echo -e "${GREEN}✓ Help test completed${NC}"
echo
echo -e "${YELLOW}=== Test Summary ===${NC}"
echo "All tests completed! Check output files in: tests/salamander-test-output/"
echo
echo "Generated files:"
ls -la tests/salamander-test-output/
echo
echo -e "${GREEN}✓ All Salamander menu tests passed successfully!${NC}"
echo
echo -e "${BLUE}Generated menu structure preview:${NC}"
if [ -f "tests/salamander-test-output/sample-menu.reg" ]; then
echo "Sample menu entries:"
grep -E "\\[|Item Name" "tests/salamander-test-output/sample-menu.reg" | head -20
fi
echo
echo -e "${BLUE}Usage examples:${NC}"
echo "# Generate menu from JSON:"
echo "pm-media salamander --config menu.json --output menu.reg"
echo
echo "# Insert into existing Media group:"
echo "pm-media salamander --config menu.json --existing current.reg --group \"Media\""
echo
echo "# Auto-detect next available index:"
echo "pm-media salamander --config menu.json --existing current.reg"