-
Notifications
You must be signed in to change notification settings - Fork 32
App Builder - Unit and Integration tests #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| better-sqlite3 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,9 @@ | |
| "deploy": "wrangler deploy", | ||
| "cf-typegen": "wrangler types --env-interface CloudflareEnv worker-configuration.d.ts", | ||
| "typecheck": "tsc --noEmit", | ||
| "test:git": "tsx src/_integration_tests/test-git-integration.ts" | ||
| "test": "vitest run", | ||
| "test:watch": "vitest", | ||
| "test:git:all": "./src/_integration_tests/run-all-tests.sh" | ||
| }, | ||
| "dependencies": { | ||
| "@ashishkumar472/cf-git": "1.0.5", | ||
|
|
@@ -18,13 +20,16 @@ | |
| "zod": "^4.1.12" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/jsonwebtoken": "^9.0.9", | ||
| "@cloudflare/containers": "^0.0.30", | ||
| "@cloudflare/sandbox": "0.6.7", | ||
| "@cloudflare/workers-types": "^4.20251014.0", | ||
| "@types/better-sqlite3": "^7.6.13", | ||
| "@types/jsonwebtoken": "^9.0.9", | ||
| "@types/node": "^22.10.1", | ||
| "better-sqlite3": "^12.6.0", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can already use:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still the old version? |
||
| "tsx": "^4.7.0", | ||
| "typescript": "^5.9.3", | ||
| "vitest": "^2.1.9", | ||
| "wrangler": "4.45.3" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Run all App Builder integration tests | ||
| # Usage: ./run-all-tests.sh | ||
| # | ||
| # Prerequisites: | ||
| # - App builder running at http://localhost:8790 | ||
| # - AUTH_TOKEN environment variable set (or uses default) | ||
|
|
||
| set -e | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| cd "$SCRIPT_DIR/../.." | ||
|
|
||
| # Default values | ||
| export APP_BUILDER_URL="${APP_BUILDER_URL:-http://localhost:8790}" | ||
| export AUTH_TOKEN="${AUTH_TOKEN:-dev-token-change-this-in-production}" | ||
|
|
||
| echo "========================================" | ||
| echo "App Builder Integration Tests" | ||
| echo "========================================" | ||
| echo "URL: $APP_BUILDER_URL" | ||
| echo "Running from: $(pwd)" | ||
| echo "========================================" | ||
| echo "" | ||
|
|
||
| TOTAL_PASSED=0 | ||
| TOTAL_FAILED=0 | ||
| FAILED_TESTS=() | ||
|
|
||
| run_test() { | ||
| local test_name="$1" | ||
| local test_file="$2" | ||
|
|
||
| echo "" | ||
| echo "========================================" | ||
| echo "Running: $test_name" | ||
| echo "========================================" | ||
| echo "" | ||
|
|
||
| if pnpm exec tsx "$test_file"; then | ||
| TOTAL_PASSED=$((TOTAL_PASSED + 1)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason why we do all of this manually? Should we not use a proper test runner instead? |
||
| else | ||
| TOTAL_FAILED=$((TOTAL_FAILED + 1)) | ||
| FAILED_TESTS+=("$test_name") | ||
| fi | ||
| } | ||
|
|
||
| # Run all test suites | ||
| run_test "Basic Git Integration" "src/_integration_tests/test-git-integration.ts" | ||
| run_test "Authentication Edge Cases" "src/_integration_tests/test-auth-edge-cases.ts" | ||
| run_test "Init Edge Cases" "src/_integration_tests/test-init-edge-cases.ts" | ||
| run_test "Files API" "src/_integration_tests/test-files-api.ts" | ||
| run_test "Delete Endpoint" "src/_integration_tests/test-delete.ts" | ||
| run_test "Advanced Git Operations" "src/_integration_tests/test-git-advanced.ts" | ||
|
|
||
| # Final summary | ||
| echo "" | ||
| echo "========================================" | ||
| echo "FINAL SUMMARY" | ||
| echo "========================================" | ||
| echo "Test suites passed: $TOTAL_PASSED" | ||
| echo "Test suites failed: $TOTAL_FAILED" | ||
|
|
||
| if [ $TOTAL_FAILED -gt 0 ]; then | ||
| echo "" | ||
| echo "Failed test suites:" | ||
| for test in "${FAILED_TESTS[@]}"; do | ||
| echo " - $test" | ||
| done | ||
| echo "" | ||
| echo "❌ SOME TEST SUITES FAILED" | ||
| exit 1 | ||
| else | ||
| echo "" | ||
| echo "🎉 ALL TEST SUITES PASSED!" | ||
| exit 0 | ||
| fi | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a bit confused here should we not run the integration tests?