Skip to content

feat(tests): add automated test suite with 187 bats-core tests#16

Open
jpelaez-23blocks wants to merge 3 commits intomainfrom
feat/automated-test-suite
Open

feat(tests): add automated test suite with 187 bats-core tests#16
jpelaez-23blocks wants to merge 3 commits intomainfrom
feat/automated-test-suite

Conversation

@jpelaez-23blocks
Copy link
Copy Markdown
Contributor

Summary

What's Covered

Unit tests (140): address parsing, message ID format, routing decisions, Ed25519 signing/verification, inbox/sent storage with replay protection, filename sanitization, attachment handling, injection detection (6 categories), trust level determination, content security wrapping

Integration tests (47): send routing (filesystem vs API), fetch URL construction with /v1/ prefix, local send end-to-end, init flow, register flow, inbox/read/delete lifecycle

Regression guards:

Infrastructure

  • tests/test_helper.bash — shared setup with env isolation ($BATS_TEST_TMPDIR), fixture helpers, PATH-based curl mocking
  • package.json — npm devDependencies for bats-core, bats-assert, bats-support
  • run_tests.sh — local test runner (./run_tests.sh unit|integration|all)
  • .github/workflows/tests.yml — CI workflow with 10min timeout

Test plan

  • All 187 tests pass locally (./run_tests.sh all)
  • GitHub Actions CI passes on this PR
  • Verify regression: revert /v1/ prefix → fetch_urls.bats fails
  • Verify regression: remove config.json check → send_routing.bats fails

🤖 Generated with Claude Code

Juan Pelaez and others added 3 commits March 26, 2026 10:14
Adds comprehensive test coverage for the claude-plugin CLI tools using
bats-core, catching the 3 shipped production bugs from PRs #14 and #15:
- Missing /v1/ prefix in fetch URLs (PR #14)
- Millisecond vs seconds timestamps in message IDs (PR #14)
- Filesystem delivery without config.json guard (PR #15)

Includes:
- 140 unit tests covering helpers (address, message ID, routing, signing,
  storage, sanitize, attachments) and security (injection, trust, wrapping)
- 47 integration tests covering send routing, fetch URLs, local send,
  init flow, register flow, and inbox/read/delete lifecycle
- Shared test_helper.bash with env isolation, fixture helpers, curl mocking
- GitHub Actions CI workflow running on every PR and push to main
- npm-based test runner with bats-core, bats-assert, bats-support

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Split CI into parallel ShellCheck + Tests jobs, add path filtering to
skip runs on doc-only changes, add concurrency groups to cancel stale
runs, and tighten timeouts. Fix SC2115 in amp-delete.sh (rm -rf guard).

- Add .shellcheckrc with baseline exclusions (SC2155, SC1090/91, SC2034)
- Replace single-job workflow with parallel lint + test jobs
- Add concurrency group (ci-${{ github.ref }}) with cancel-in-progress
- Add path filters for scripts/, tests/, package files, workflow
- Reduce timeouts: 3min lint, 5min tests (was 10min single job)
- Fix rm -rf to use ${var:?} guard against empty variable expansion
- Add npm lint script for local shellcheck runs

Co-authored-by: Juan Pelaez <juan.pelaez@3metas.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Assigns @jpelaez-23blocks as code owner for all files, with explicit
entries for scripts/, tests/, and .github/ to ensure CI and core code
changes always require owner review.

Co-authored-by: Juan Pelaez <juan.pelaez@3metas.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant