Skip to content

Add tests for verifyPeerReview CLI skeleton#78

Merged
marcochavezf merged 3 commits into
mainfrom
rory-peer-review-02d-tests
Jul 3, 2026
Merged

Add tests for verifyPeerReview CLI skeleton#78
marcochavezf merged 3 commits into
mainfrom
rory-peer-review-02d-tests

Conversation

@roryabraham

@roryabraham roryabraham commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Details

Adds a test file for scripts/verifyPeerReview.ts's CLI argument parsing:

  • tests/verifyPeerReviewCli.test.ts — exercises CLI argument parsing (owner/repo/pull-request-number/base-ref, via expensify-common/CLI) against scripts/verifyPeerReview.ts. The script currently only parses and logs its CLI arguments (it doesn't call the GitHub API yet), so the test only covers argument parsing.
  • .github/workflows/test.yml — CI workflow that runs npm test on relevant file changes.
  • A test npm script (tsx --test tests/*.test.ts), using Node's built-in node:test runner. No new dependencies were needed since tsx was already a devDependency.

Verified the CLI's missing-required-argument behavior directly against node_modules/expensify-common/dist/CLI.js: when a required named arg is missing, the constructor throws Error("Missing required named argument --<name>"), which is caught internally and results in a synchronous process.exit(1) call. Since the test mocks process.exit to throw, and main() constructs the CLI synchronously (not awaited), this manifests as main()'s returned promise rejecting with exit 1 — matching the assertion in the test.

Related Issues

https://github.com/Expensify/Expensify/issues/636197

Manual Tests

Ran npm test locally — both test cases pass (parses required CLI args successfully; fails when required args are missing).

Linked PRs

N/A

Made with Cursor

Adds a trimmed tests/verifyPeerReviewCli.test.ts that exercises CLI
argument parsing against the current no-op skeleton, plus the test
npm script and CI workflow to run it. GitHubUtils stubbing will be
reintroduced in Phase 3 once the real logic lands.

Co-authored-by: Cursor <cursoragent@cursor.com>
@roryabraham roryabraham changed the title Add tests for verifyPeerReview CLI skeleton (Phase 2d of #64 split) Add tests for verifyPeerReview CLI skeleton Jul 3, 2026
@roryabraham roryabraham marked this pull request as ready for review July 3, 2026 05:04
@roryabraham roryabraham requested a review from marcochavezf July 3, 2026 05:04
@marcochavezf marcochavezf merged commit 30c7ec3 into main Jul 3, 2026
7 checks passed
@marcochavezf marcochavezf deleted the rory-peer-review-02d-tests branch July 3, 2026 06:01
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.

2 participants