# Test Intelligent Hints System # Tests for CLI hints, guide system, and next-step suggestions use ../lib_provisioning/utils/hints.nu * # Test hint utilities export def test_show_next_step [] { print "\n=== Testing show-next-step ===" print "\n--- Server Create Hint ---" show-next-step "server_create" {infra: "test-infra"} print "\n--- Taskserv Create Hint ---" show-next-step "taskserv_create" {name: "kubernetes"} print "\n--- Workspace Init Hint ---" show-next-step "workspace_init" {name: "my-project"} print "\n--- Cluster Create Hint ---" show-next-step "cluster_create" {name: "buildkit"} print "\n--- Workspace Activate Hint ---" show-next-step "workspace_activate" {name: "production"} } # Test documentation links export def test_doc_links [] { print "\n=== Testing show-doc-link ===" print "\n--- Infrastructure Topic ---" show-doc-link "infrastructure" print "\n--- Workspace Topic (compact) ---" show-doc-link "workspace" --compact print "\n--- Quick Start Topic ---" show-doc-link "from-scratch" } # Test examples export def test_examples [] { print "\n=== Testing show-example ===" print "\n--- Server Create Examples ---" show-example "server_create" print "\n--- Taskserv Create Examples ---" show-example "taskserv_create" print "\n--- Workspace Init Examples ---" show-example "workspace_init" print "\n--- Module Discover Examples ---" show-example "module_discover" } # Test error messages export def test_errors [] { print "\n=== Testing show-error ===" print "\n--- Workspace Not Found Error ---" show-error "workspace_not_found" "Workspace 'my-project' not found" "Initialize workspace first" "workspace" print "\n--- No Servers Error ---" show-error "no_servers" "No servers found in infrastructure" "Create servers to continue" "infrastructure" print "\n--- Taskserv Not Found Error ---" show-error "taskserv_not_found" "Taskserv 'unknown' not available" "Check available taskservs" "infrastructure" print "\n--- Invalid Config Error ---" show-error "invalid_config" "Configuration validation failed" "Review and fix configuration errors" "workspace" print "\n--- Orchestrator Not Running Error ---" show-error "orchestrator_not_running" "Orchestrator service not available" "Start orchestrator service" "orchestration" } # Test message formatting export def test_messages [] { print "\n=== Testing Message Formatting ===" print "\n--- Success Messages ---" success-message "Servers created successfully" success-message "Custom icon test" --icon "šŸŽ‰" print "\n--- Warning Messages ---" warning-message "Some optional services are not configured" warning-message "Custom warning icon" --icon "⚔" print "\n--- Info Messages ---" info-message "Using default configuration values" info-message "Custom info icon" --icon "šŸ“" } # Test progress indicators export def test_progress [] { print "\n=== Testing Progress Indicators ===" for step in 1..5 { show-progress $step 5 $"Processing step ($step)" } } # Test tips export def test_tips [] { print "\n=== Testing Tips ===" print "\n--- Normal Tip ---" show-tip "Use --check flag to preview changes without applying them" print "\n--- Compact Tip ---" show-tip "Compact tip format" --compact } # Test contextual hints export def test_contextual_hints [] { print "\n=== Testing Contextual Hints ===" print "\n--- No Workspace ---" show-contextual-hint {workspace: null, servers: [], taskservs: []} print "\n--- Workspace but No Servers ---" show-contextual-hint {workspace: "test", servers: [], taskservs: []} print "\n--- Workspace and Servers but No Taskservs ---" show-contextual-hint {workspace: "test", servers: ["server1"], taskservs: []} } # Run all tests export def run_all_tests [] { print "╔═══════════════════════════════════════════════════════╗" print "ā•‘ INTELLIGENT HINTS SYSTEM - COMPREHENSIVE TEST SUITE ā•‘" print "ā•šā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•" test_show_next_step test_doc_links test_examples test_errors test_messages test_progress test_tips test_contextual_hints print "\n╔═══════════════════════════════════════════════════════╗" print "ā•‘ ALL TESTS COMPLETED ā•‘" print "ā•šā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•\n" } # Quick test command export def main [] { run_all_tests }