chore: consolidate local WIP (repo cleanup 20260707)
Some checks failed
API CI / API Lint (push) Successful in 47s
API CI / API Type Check (push) Failing after 47s
API CI / API Test (push) Successful in 1m0s
API CI / API Build (push) Failing after 50s
API CI / Build Docker Image (push) Has been skipped
Build Crossplane Provider / build (push) Failing after 5m51s
CD Pipeline / Deploy to Staging (push) Failing after 29s
CI Pipeline / Lint and Type Check (push) Failing after 36s
CI Pipeline / Build (push) Has been skipped
CI Pipeline / Test Backend (push) Failing after 1m33s
CI Pipeline / Test Frontend (push) Failing after 30s
CI Pipeline / Security Scan (push) Failing after 1m16s
Crossplane Provider CI / Go Test (push) Failing after 3m23s
Crossplane Provider CI / Go Lint (push) Failing after 7m27s
Crossplane Provider CI / Go Build (push) Failing after 3m27s
Deploy to Staging / Deploy to Staging (push) Failing after 30s
Portal CI / Portal Lint (push) Failing after 21s
Portal CI / Portal Type Check (push) Failing after 21s
Portal CI / Portal Test (push) Failing after 21s
Portal CI / Portal Build (push) Failing after 22s
Test Suite / frontend-tests (push) Failing after 30s
Test Suite / api-tests (push) Failing after 49s
Test Suite / blockchain-tests (push) Failing after 30s
Type Check / type-check (map[directory:. name:root]) (push) Failing after 23s
Type Check / type-check (map[directory:api name:api]) (push) Failing after 21s
Type Check / type-check (map[directory:portal name:portal]) (push) Failing after 19s
Validate Configuration Files / validate (push) Failing after 1m52s
CD Pipeline / Deploy to Production (push) Has been skipped

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
defiQUG
2026-07-07 09:41:34 -07:00
parent 477cf73005
commit 33d50fb91e
277 changed files with 44421 additions and 75 deletions

155
scripts/test-scan-projects.sh Executable file
View File

@@ -0,0 +1,155 @@
#!/bin/bash
# Integration test script for scan-projects.ts
# Tests the script with a mock projects directory structure
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
TEST_DIR="/tmp/scan-projects-test-$$"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
cleanup() {
echo -e "${YELLOW}Cleaning up test directory: $TEST_DIR${NC}"
rm -rf "$TEST_DIR"
}
trap cleanup EXIT
echo -e "${GREEN}Setting up test environment...${NC}"
# Create test directory structure
mkdir -p "$TEST_DIR"
# Create test projects
mkdir -p "$TEST_DIR/git-repo"
cd "$TEST_DIR/git-repo"
git init --quiet
git remote add origin "https://github.com/testuser/git-repo.git" 2>/dev/null || true
echo "# Test Project" > README.md
git add README.md
git commit -m "Initial commit" --quiet 2>/dev/null || true
mkdir -p "$TEST_DIR/monorepo"
cd "$TEST_DIR/monorepo"
cat > package.json <<EOF
{
"name": "monorepo",
"version": "1.0.0",
"workspaces": ["packages/*"]
}
EOF
mkdir -p packages/pkg1 packages/pkg2
echo '{"name": "pkg1"}' > packages/pkg1/package.json
echo '{"name": "pkg2"}' > packages/pkg2/package.json
echo 'packages:' > pnpm-workspace.yaml
mkdir -p "$TEST_DIR/npm-project"
cd "$TEST_DIR/npm-project"
cat > package.json <<EOF
{
"name": "npm-project",
"version": "1.0.0"
}
EOF
echo '{}' > package-lock.json
mkdir -p "$TEST_DIR/yarn-project"
cd "$TEST_DIR/yarn-project"
cat > package.json <<EOF
{
"name": "yarn-project",
"version": "1.0.0"
}
EOF
echo '{}' > yarn.lock
mkdir -p "$TEST_DIR/invalid-name project"
cd "$TEST_DIR/invalid-name project"
cat > package.json <<EOF
{
"name": "invalid-name project",
"version": "1.0.0"
}
EOF
echo -e "${GREEN}Test environment created at: $TEST_DIR${NC}"
echo ""
echo "Test projects:"
echo " - git-repo (Git repository)"
echo " - monorepo (Monorepo with workspaces)"
echo " - npm-project (npm project)"
echo " - yarn-project (yarn project)"
echo " - invalid-name project (invalid name for testing)"
echo ""
# Check if API is available
if [ -z "${GRAPHQL_API_URL:-}" ]; then
GRAPHQL_API_URL="http://localhost:4000/graphql"
fi
echo -e "${YELLOW}Testing with API: $GRAPHQL_API_URL${NC}"
echo ""
# Test 1: Dry run
echo -e "${GREEN}Test 1: Dry run${NC}"
cd "$PROJECT_ROOT"
if pnpm tsx scripts/scan-projects.ts \
--dry-run \
--projects-dir "$TEST_DIR" \
--api-url "$GRAPHQL_API_URL" \
--verbose 2>&1 | grep -q "DRY RUN"; then
echo -e "${GREEN}✓ Dry run test passed${NC}"
else
echo -e "${RED}✗ Dry run test failed${NC}"
exit 1
fi
echo ""
# Test 2: Validation (should fail on invalid project name)
echo -e "${GREEN}Test 2: Validation${NC}"
if pnpm tsx scripts/scan-projects.ts \
--dry-run \
--projects-dir "$TEST_DIR" \
--api-url "$GRAPHQL_API_URL" \
--verbose 2>&1 | grep -q "invalid-name project"; then
echo -e "${GREEN}✓ Validation test passed (invalid name detected)${NC}"
else
echo -e "${YELLOW}⚠ Validation test: Invalid name may have been sanitized${NC}"
fi
echo ""
# Test 3: JSON output
echo -e "${GREEN}Test 3: JSON output${NC}"
if pnpm tsx scripts/scan-projects.ts \
--dry-run \
--projects-dir "$TEST_DIR" \
--api-url "$GRAPHQL_API_URL" \
--output json 2>&1 | grep -q '"created"'; then
echo -e "${GREEN}✓ JSON output test passed${NC}"
else
echo -e "${RED}✗ JSON output test failed${NC}"
exit 1
fi
echo ""
# Test 4: Help
echo -e "${GREEN}Test 4: Help command${NC}"
if pnpm tsx scripts/scan-projects.ts --help 2>&1 | grep -q "Scan projects directory"; then
echo -e "${GREEN}✓ Help command test passed${NC}"
else
echo -e "${RED}✗ Help command test failed${NC}"
exit 1
fi
echo ""
echo -e "${GREEN}All integration tests passed!${NC}"