test(integration): add integration tests against a real forgejo instance #266
Loading…
Reference in a new issue
No description provided.
Delete branch "test/integration-tests"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implements the integration layer (Layer 2) of the testing strategy, following the decision that
examples/event_payloads/are reference-only: tests run against a real Forgejo instance so the schemas are always validated against live payloads.16 integration tests (all green against Forgejo 15.0.3), covering:
test/integration/forgejo.test.ts— the Forgejo client: repositories, issues, comments, pull requests, reviews and inline review comments. Every call goes throughforgejoFetch, which validates responses against the TypeBox schemas, so a passing suite is the "content always synced" guarantee.test/integration/context.test.ts—getEventContextfor issue and pull request events against live data.test/integration/tools.test.ts— all five tools execute against the real REST API, includingcreate-pr-review(run from a checkout of the PR head branch sogetLatestCommitId()resolves a real commit).Infrastructure
docker-compose.test.yaml— pinned Forgejo 15.0.3 service (same version the payloads were captured on) with healthcheck.scripts/integration-setup.sh— POSIX sh; creates users + access tokens via the Forgejo CLI in the container, deletes/recreates the test repository (deterministic data on every run), pushes a change branch with a known diff, seeds an issue with a comment, and writestest/integration/credentials.json(gitignored).vitest.integration.config.ts+pnpm test:integration— separate config so the defaultpnpm test(unit) stays fast and doesn't need the instance; files run sequentially to keep tests order-independent..devcontainer/docker-compose.yaml, so tests can run from the workspace container.test/README.md— run instructions (up, provision, test).Notes
defineToolfrom@earendil-works/pi-coding-agentis mocked (metadata factory); the tools'executefunctions run for real. See the unit tests for why the package itself can't be imported outside the bundle (@earendil-works/pi-serveris not installed).test.yamlworkflow) is intentionally left as the next step — it needs a docker-capable runner; happy to add it in a follow-up once the runner setup is decided.Checks
pnpm check/lint:check/format:check/pnpm test(23 unit) ✅ ·pnpm test:integration16/16 ✅ (validated against a live Forgejo 15.0.3 instance) · yamllint + prettier ✅View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.