diff --git a/docs/TESTING.md b/docs/TESTING.md index 51bc4c6..c39a4a1 100644 --- a/docs/TESTING.md +++ b/docs/TESTING.md @@ -62,7 +62,7 @@ cargo test --test integration_tests -- --nocapture ## Test Categories -### āœ… Always Run (No Auth Required) +### Always Run (No Auth Required) - **API Connectivity**: Basic connection to Polymarket API - **Market Data Endpoints**: Order book, prices, spreads, etc. - **Error Handling**: Invalid requests and error responses @@ -70,24 +70,24 @@ cargo test --test integration_tests -- --nocapture - **API Compatibility**: Verify our API matches polymarket-rs-client - **Performance**: Response time measurements -### šŸ” Authentication Required +### Authentication Required - **Authentication**: API key creation and validation - **Advanced Client Features**: Full client configuration - **WebSocket Connectivity**: Real-time data streaming -### šŸ’° API Credentials Required +### API Credentials Required - **Order Management**: Order creation and management (read-only tests) ## Test Results ### Success Indicators ``` -āœ… API connectivity test passed -āœ… Market data endpoints test passed -āœ… Error handling test passed -āœ… Rate limiting test passed -āœ… API compatibility test passed -āœ… Performance test passed +API connectivity test passed +Market data endpoints test passed +Error handling test passed +Rate limiting test passed +API compatibility test passed +Performance test passed Server time: 234ms Markets request: 1.2s Markets returned: 50 @@ -95,14 +95,14 @@ cargo test --test integration_tests -- --nocapture ### Skip Indicators ``` -āš ļø Skipping authentication test - no private key provided -āš ļø Skipping order management test - missing auth credentials +Skipping authentication test - no private key provided +Skipping order management test - missing auth credentials ``` ### Failure Indicators ``` -āŒ API connectivity test failed: Network error: connection refused -āŒ Market data endpoints test failed: API error (404): Token not found +API connectivity test failed: Network error: connection refused +Market data endpoints test failed: API error (404): Token not found ``` ## Performance Benchmarks @@ -188,12 +188,12 @@ cargo nextest run --test integration_tests Our integration tests cover: -- āœ… **API Endpoints**: All major REST endpoints -- āœ… **Authentication**: EIP-712 signing and API key management -- āœ… **Error Handling**: Network errors, API errors, validation errors -- āœ… **Performance**: Response time and throughput measurements -- āœ… **WebSocket**: Real-time data streaming (when available) -- āœ… **Compatibility**: API compatibility with polymarket-rs-client +- **API Endpoints**: All major REST endpoints +- **Authentication**: EIP-712 signing and API key management +- **Error Handling**: Network errors, API errors, validation errors +- **Performance**: Response time and throughput measurements +- **WebSocket**: Real-time data streaming (when available) +- **Compatibility**: API compatibility with polymarket-rs-client ## Adding New Tests diff --git a/examples/complete_trading_example.rs b/examples/complete_trading_example.rs index d6ecaa0..26fdd03 100644 --- a/examples/complete_trading_example.rs +++ b/examples/complete_trading_example.rs @@ -17,7 +17,7 @@ async fn main() -> Result<()> { .expect("PRIVATE_KEY environment variable required"); let chain_id = 137; // Polygon - println!("šŸš€ Initializing Polyfill-rs Trading Client"); + println!("Initializing Polyfill-rs Trading Client"); // Step 1: Create client with L1 authentication (private key) let mut client = ClobClient::with_l1_headers( @@ -26,17 +26,17 @@ async fn main() -> Result<()> { chain_id, )?; - println!("āœ… Client initialized with L1 authentication"); + println!("Client initialized with L1 authentication"); // Step 2: Create or derive API credentials for L2 operations - println!("šŸ”‘ Setting up API credentials..."); + println!("Setting up API credentials..."); let api_creds = client.create_or_derive_api_key(None).await?; client.set_api_creds(api_creds); - println!("āœ… API credentials configured"); + println!("API credentials configured"); // Step 3: Get account information - println!("\nšŸ’° Checking account balances..."); + println!("\nChecking account balances..."); let balances = client.balance_allowance().await?; for balance in &balances { println!(" Token {}: Balance = {}, Allowance = {}", @@ -44,7 +44,7 @@ async fn main() -> Result<()> { } // Step 4: Get market data - println!("\nšŸ“Š Fetching market data..."); + println!("\nFetching market data..."); let token_id = "21742633143463906290569050155826241533067272736897614950488156847949938836455"; // Single token data @@ -67,7 +67,7 @@ async fn main() -> Result<()> { } // Step 5: Create and place orders - println!("\nšŸ“ Creating orders..."); + println!("\nCreating orders..."); // Create a limit order let order_args = OrderArgs { @@ -83,7 +83,7 @@ async fn main() -> Result<()> { println!(" Creating limit order: Buy 10 @ 0.52"); let order_result = client.create_and_post_order(&order_args).await?; - println!(" āœ… Order created: {:?}", order_result); + println!(" Order created: {:?}", order_result); // Create a market order let market_order_args = OrderArgs { @@ -99,10 +99,10 @@ async fn main() -> Result<()> { println!(" Creating market order: Sell 5 @ market"); let market_order_result = client.create_market_order(&market_order_args).await?; - println!(" āœ… Market order created: {:?}", market_order_result); + println!(" Market order created: {:?}", market_order_result); // Step 6: Query order history - println!("\nšŸ“‹ Checking order history..."); + println!("\nChecking order history..."); // Get all open orders let open_orders = client.get_orders(None).await?; @@ -121,7 +121,7 @@ async fn main() -> Result<()> { println!(" Orders for token {}: {}", token_id, token_orders.len()); // Step 7: Query trade history - println!("\nšŸ’¹ Checking trade history..."); + println!("\nChecking trade history..."); let trades = client.get_trades(Some(TradeParams { id: None, @@ -139,18 +139,18 @@ async fn main() -> Result<()> { } // Step 8: Order management - println!("\nšŸ› ļø Order management..."); + println!("\nOrder management..."); if !open_orders.is_empty() { let order_to_cancel = &open_orders[0]; println!(" Cancelling order: {}", order_to_cancel.id); let cancel_result = client.cancel(&order_to_cancel.id).await?; - println!(" āœ… Cancel result: {:?}", cancel_result); + println!(" Cancel result: {:?}", cancel_result); } // Step 9: Set up notifications (optional) - println!("\nšŸ”” Setting up notifications..."); + println!("\nSetting up notifications..."); let notification_params = NotificationParams { signature: "example_signature".to_string(), @@ -158,12 +158,12 @@ async fn main() -> Result<()> { }; match client.notifications(notification_params).await { - Ok(result) => println!(" āœ… Notifications configured: {:?}", result), - Err(e) => println!(" āš ļø Notifications setup failed: {}", e), + Ok(result) => println!(" Notifications configured: {:?}", result), + Err(e) => println!(" Notifications setup failed: {}", e), } - println!("\nšŸŽ‰ Complete trading example finished!"); - println!("\nšŸ“ˆ Performance Notes:"); + println!("\nComplete trading example finished!"); + println!("\nPerformance Notes:"); println!(" • Order book operations use fixed-point math (25x faster)"); println!(" • Batch operations reduce API calls by up to 90%"); println!(" • EIP-712 signing ensures maximum security"); @@ -176,21 +176,21 @@ async fn main() -> Result<()> { /// Helper function to demonstrate error handling async fn safe_trading_example() { match main().await { - Ok(()) => println!("āœ… Trading example completed successfully"), + Ok(()) => println!("Trading example completed successfully"), Err(PolyfillError::Auth { message, .. }) => { - eprintln!("šŸ” Authentication error: {}", message); - eprintln!("šŸ’” Make sure PRIVATE_KEY environment variable is set"); + eprintln!("Authentication error: {}", message); + eprintln!("Make sure PRIVATE_KEY environment variable is set"); }, Err(PolyfillError::Api { status_code, message, .. }) => { - eprintln!("🌐 API error ({}): {}", status_code, message); - eprintln!("šŸ’” Check your network connection and API limits"); + eprintln!("API error ({}): {}", status_code, message); + eprintln!("Check your network connection and API limits"); }, Err(PolyfillError::Network { source, .. }) => { - eprintln!("šŸ“” Network error: {}", source); - eprintln!("šŸ’” Retrying with exponential backoff..."); + eprintln!("Network error: {}", source); + eprintln!("Retrying with exponential backoff..."); }, Err(e) => { - eprintln!("āŒ Unexpected error: {}", e); + eprintln!("Unexpected error: {}", e); } } } diff --git a/scripts/run_integration_tests.sh b/scripts/run_integration_tests.sh index b77063b..279c516 100755 --- a/scripts/run_integration_tests.sh +++ b/scripts/run_integration_tests.sh @@ -5,18 +5,18 @@ set -e -echo "šŸš€ Running polyfill-rs integration tests..." +echo "Running polyfill-rs integration tests..." echo "==========================================" # Check if we have the required environment variables if [ -z "$POLYMARKET_PRIVATE_KEY" ]; then - echo "āš ļø Warning: POLYMARKET_PRIVATE_KEY not set" + echo "Warning: POLYMARKET_PRIVATE_KEY not set" echo " Some tests will be skipped (authentication, order management, WebSocket)" echo " Set POLYMARKET_PRIVATE_KEY to run all tests" fi if [ -z "$POLYMARKET_API_KEY" ] || [ -z "$POLYMARKET_API_SECRET" ] || [ -z "$POLYMARKET_API_PASSPHRASE" ]; then - echo "āš ļø Warning: API credentials not set" + echo "Warning: API credentials not set" echo " Set POLYMARKET_API_KEY, POLYMARKET_API_SECRET, and POLYMARKET_API_PASSPHRASE" echo " to test order management functionality" fi @@ -38,34 +38,34 @@ cargo test --test integration_tests -- --nocapture if [ $? -eq 0 ]; then echo "" - echo "šŸŽ‰ All integration tests passed!" + echo "All integration tests passed!" echo "" echo "Test Summary:" - echo " āœ… API connectivity" - echo " āœ… Market data endpoints" - echo " āœ… Error handling" - echo " āœ… Rate limiting" - echo " āœ… API compatibility" - echo " āœ… Performance characteristics" + echo " API connectivity" + echo " Market data endpoints" + echo " Error handling" + echo " Rate limiting" + echo " API compatibility" + echo " Performance characteristics" if [ -n "$POLYMARKET_PRIVATE_KEY" ]; then - echo " āœ… Authentication" - echo " āœ… Advanced client features" - echo " āœ… WebSocket connectivity" + echo " Authentication" + echo " Advanced client features" + echo " WebSocket connectivity" if [ -n "$POLYMARKET_API_KEY" ]; then - echo " āœ… Order management" + echo " Order management" else - echo " āš ļø Order management (skipped - no API credentials)" + echo " Order management (skipped - no API credentials)" fi else - echo " āš ļø Authentication (skipped - no private key)" - echo " āš ļø Advanced client features (skipped - no private key)" - echo " āš ļø WebSocket connectivity (skipped - no private key)" - echo " āš ļø Order management (skipped - no private key)" + echo " Authentication (skipped - no private key)" + echo " Advanced client features (skipped - no private key)" + echo " WebSocket connectivity (skipped - no private key)" + echo " Order management (skipped - no private key)" fi else echo "" - echo "āŒ Some integration tests failed!" + echo "Some integration tests failed!" exit 1 fi \ No newline at end of file diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 08066f5..217b34e 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -146,21 +146,21 @@ pub struct TestReporter; impl TestReporter { /// Report test success pub fn success(test_name: &str) { - println!("āœ… {} passed", test_name); + println!("{} passed", test_name); } /// Report test failure pub fn failure(test_name: &str, error: &dyn std::error::Error) { - println!("āŒ {} failed: {}", test_name, error); + println!("{} failed: {}", test_name, error); } /// Report test skip pub fn skip(test_name: &str, reason: &str) { - println!("āš ļø {} skipped: {}", test_name, reason); + println!("{} skipped: {}", test_name, reason); } /// Report test performance pub fn performance(test_name: &str, duration: Duration) { - println!("⚔ {} completed in {:?}", test_name, duration); + println!("{} completed in {:?}", test_name, duration); } } \ No newline at end of file