Files
sf-cli-wrapper/quick-test.sh
reynold 43fc686e26 Remove all long options (--) for complete consistency
 Major Consistency Update:
- Removed ALL long options (--target-org, --help, etc.) from scripts
- Now using ONLY two-character options (-to, -hp, etc.)
- Complete consistency across all wrapper scripts

Updated Scripts:
 sf-deploy: Removed --target-org, --sources, --directory, --tests, --help
 sf-dry-run: Removed all --long options, matching sf-deploy
 sf-web-open: Removed --target-org, --path, --url-only, --help
 sf-data-export: Removed all --long options throughout
 sf-logs-tail: Removed all --long options and updated help text

Updated Test Scripts:
 test-wrapper-suite.sh: Removed --help tests and --long option tests
 quick-test.sh: Updated to use -ls instead of --list
 All tests now use only two-character options

🎯 Result: Pure two-character option interface
- Clean, consistent UX: -to, -sr, -dr, -ts, -hp, -qy, -fl, etc.
- No mixing of single-char, two-char, and long options
- Memorable, self-documenting option names throughout
2025-08-28 18:51:13 +08:00

123 lines
3.3 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
# Quick Validation Test for SF CLI Wrapper Scripts
# Tests essential functionality with PWC-TEAM-DEV org
readonly TEST_ORG="PWC-TEAM-DEV"
readonly GREEN='\033[0;32m'
readonly RED='\033[0;31m'
readonly YELLOW='\033[0;33m'
readonly BLUE='\033[0;34m'
readonly NC='\033[0m' # No Color
echo -e "${BLUE}SF CLI Wrapper Quick Validation${NC}"
echo -e "${BLUE}===============================${NC}"
echo -e "${YELLOW}Target Org: $TEST_ORG${NC}"
echo ""
# Test counters
TESTS=0
PASSED=0
test_help() {
local script="$1"
echo -n "Testing $script help... "
((TESTS++))
if ./$script -hp >/dev/null 2>&1; then
echo -e "${GREEN}${NC}"
((PASSED++))
else
echo -e "${RED}${NC}"
fi
}
test_two_char_options() {
local script="$1"
local test_cmd="$2"
echo -n "Testing $script two-char options... "
((TESTS++))
# Test that the script recognizes the two-character option (even if it fails later due to missing data)
if eval "$test_cmd" 2>&1 | grep -q "Unknown option" || eval "$test_cmd" 2>&1 | grep -q "Invalid option"; then
echo -e "${RED}${NC} (Two-character option not recognized)"
else
echo -e "${GREEN}${NC}"
((PASSED++))
fi
}
echo -e "${BLUE}=== Testing Help Functions ===${NC}"
test_help "sf-check"
test_help "sf-deploy"
test_help "sf-dry-run"
test_help "sf-web-open"
test_help "sf-org-create"
test_help "sf-org-info"
test_help "sf-retrieve"
test_help "sf-test-run"
test_help "sf-apex-run"
test_help "sf-data-export"
test_help "sf-data-import"
test_help "sf-logs-tail"
echo ""
echo -e "${BLUE}=== Testing Two-Character Options ===${NC}"
test_two_char_options "sf-deploy" "./sf-deploy -to $TEST_ORG >/dev/null 2>&1 || true"
test_two_char_options "sf-dry-run" "./sf-dry-run -to $TEST_ORG >/dev/null 2>&1 || true"
test_two_char_options "sf-web-open" "./sf-web-open -to $TEST_ORG -ur >/dev/null 2>&1 || true"
test_two_char_options "sf-org-create" "./sf-org-create -al Test >/dev/null 2>&1 || true"
test_two_char_options "sf-data-export" "./sf-data-export -qy 'SELECT Id FROM User LIMIT 1' -to $TEST_ORG >/dev/null 2>&1 || true"
echo ""
echo -e "${BLUE}=== Testing Basic Functionality ===${NC}"
# Test sf-check
echo -n "Testing sf-check basic... "
((TESTS++))
if ./sf-check >/dev/null 2>&1; then
echo -e "${GREEN}${NC}"
((PASSED++))
else
echo -e "${RED}${NC}"
fi
# Test sf-org-info
echo -n "Testing sf-org-info... "
((TESTS++))
if ./sf-org-info -ls >/dev/null 2>&1; then
echo -e "${GREEN}${NC}"
((PASSED++))
else
echo -e "${RED}${NC}"
fi
# Test sf-web-open URL mode
echo -n "Testing sf-web-open URL-only... "
((TESTS++))
if ./sf-web-open -to $TEST_ORG -ur >/dev/null 2>&1; then
echo -e "${GREEN}${NC}"
((PASSED++))
else
echo -e "${RED}${NC}"
fi
echo ""
echo -e "${BLUE}=== Quick Test Summary ===${NC}"
echo -e "${BLUE}========================${NC}"
echo "Tests run: $TESTS"
echo -e "${GREEN}Passed: $PASSED${NC}"
echo -e "${RED}Failed: $((TESTS - PASSED))${NC}"
if [[ $PASSED -eq $TESTS ]]; then
echo ""
echo -e "${GREEN}🎉 All quick tests passed!${NC}"
echo -e "${YELLOW}Run ./test-all-wrappers.sh for comprehensive testing.${NC}"
exit 0
else
echo ""
echo -e "${RED}❌ Some quick tests failed.${NC}"
echo -e "${YELLOW}Run ./test-all-wrappers.sh for detailed testing.${NC}"
exit 1
fi