Run comprehensive test suite for meme-perp-dex project. Use when user wants to test, verify, or validate functionality. Runs backend tests, contract tests, and validation scripts.
Comprehensive testing framework for validating meme-perp-dex functionality.
Use this skill when:
Located in: backend/src/matching/
Authentication Tests:
cd backend/src/matching
bun test-auth.ts
Tests:
Token Metadata Tests:
bun test-token-metadata.ts
Tests:
FOMO/Leaderboard Tests:
bun test-fomo.ts
Tests:
Replay Service Tests:
bun test-relay.ts
Tests:
Wallet Verification:
bun verify-derived-wallets.ts
Validates:
Located in: contracts/
Run All Contract Tests:
cd contracts
forge test -vv
Specific Test Suites:
# Perpetual trading
forge test --match-contract PerpetualTradingTest -vv
# Multi-token support
forge test --match-contract MultiTokenTest -vv
# Risk control
forge test --match-contract RiskControlTest -vv
# Token factory
forge test --match-contract TokenFactoryTest -vv
# Check server health
curl http://localhost:8081/health
# Verify Redis
curl http://localhost:8081/api/redis/status
# Test market data
curl http://localhost:8081/api/v1/market/tickers
Run critical tests only:
cd backend/src/matching
echo "=== Testing Auth ==="
bun test-auth.ts
echo "=== Testing Metadata ==="
bun test-token-metadata.ts
echo "=== Testing FOMO ==="
bun test-fomo.ts
echo "=== Testing Relay ==="
bun test-relay.ts
Run all tests including contracts:
# Backend tests
cd backend/src/matching
bun test-auth.ts
bun test-token-metadata.ts
bun test-fomo.ts
bun test-relay.ts
bun verify-derived-wallets.ts
# Contract tests
cd ../../contracts
forge test -vv
Complete validation before deployment:
# 1. Backend module tests
cd backend/src/matching
for test in test-*.ts; do
echo "Running $test..."
bun "$test"
done
# 2. Wallet verification
bun verify-derived-wallets.ts
# 3. Contract tests
cd ../../contracts
forge test -vv
# 4. Server integration (requires running server)
curl http://localhost:8081/health
curl http://localhost:8081/api/redis/status
curl http://localhost:8081/api/v1/relay/status
# 5. Check git status
git status
# 6. Verify environment
echo "Checking environment variables..."
[ -n "$SETTLEMENT_ADDRESS" ] && echo "✅ SETTLEMENT_ADDRESS set" || echo "❌ SETTLEMENT_ADDRESS missing"
[ -n "$TOKEN_FACTORY_ADDRESS" ] && echo "✅ TOKEN_FACTORY_ADDRESS set" || echo "❌ TOKEN_FACTORY_ADDRESS missing"
"Redis not connected":
# Start Redis
redis-server
# Or check if running
redis-cli ping
"RELAYER_PRIVATE_KEY not set":
# Expected in dev - relay tests skip gracefully
# For full testing, set environment variable
export RELAYER_PRIVATE_KEY="0x..."
"Contract test failed":
# Run with more verbosity
forge test --match-test <testName> -vvvv
# Check foundry.toml configuration
"Wallet verification failed":
# Check Settlement address
echo $SETTLEMENT_ADDRESS
# Verify RPC connection
curl https://sepolia.base.org
After running tests, provide summary:
=============================================================
Test Results Summary
=============================================================
Backend Tests:
✅ Authentication (test-auth.ts) - PASS
✅ Token Metadata (test-token-metadata.ts) - PASS
✅ FOMO/Leaderboard (test-fomo.ts) - PASS
⚠️ Relay Service (test-relay.ts) - SKIP (no config)
✅ Wallet Verification - PASS (100/100)
Contract Tests:
✅ forge test - PASS (XX tests)
Integration:
✅ Server health - OK
✅ Redis status - Connected
Overall: ✅ READY FOR DEPLOYMENT
=============================================================
Create .git/hooks/pre-commit:
#!/bin/bash
cd backend/src/matching
bun test-auth.ts || exit 1
bun test-token-metadata.ts || exit 1
bun test-fomo.ts || exit 1
echo "✅ All tests passed"