Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .cursor/commands/smoke-test.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
description: Run smoke tests against the live Lambda function (requires FUNCTION_URL and WEBHOOK_SECRET in .env)
globs:
- "scripts/smoke-test.js"
- "tests/fixtures/**/*.json"
---
node scripts/smoke-test.js all
26 changes: 26 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,24 @@ pr:
- `npm run tests:rep` run the tests with no code coverage verification and create *unit-tests-result.json*
- `npm run lint` lint the project

### Smoke testing

The smoke test script sends signed webhook events to the live Lambda function and verifies HTTP responses.
It requires `FUNCTION_URL` and `WEBHOOK_SECRET` in your `.env` file.

- `node scripts/smoke-test.js ping` send a ping event
- `node scripts/smoke-test.js all` send all event types (ping, pull_request.opened, pull_request.closed,
pull_request_review.submitted)

Individual event types can also be run by name (e.g. `node scripts/smoke-test.js pull_request.opened`).
The script includes retry logic to handle cold starts and propagation delays.

The smoke test also runs automatically after each release via the
[smoke-test workflow](.github/workflows/smoke-test.yml), which can be triggered manually from the GitHub Actions UI.

Test payloads are stored as JSON files in [tests/fixtures/](tests/fixtures/) and are shared with the
integration tests.

### Developing Handlers

All handlers are located in [src/handlers/](https://github.com/TomerFi/auto-me-bot/tree/main/src/handlers).<br/>
Expand Down Expand Up @@ -110,6 +128,13 @@ module.exports.run = async function(context, config, startedAt) {
All handler unit tests are located in [tests/handlers/](https://github.com/TomerFi/auto-me-bot/tree/main/tests/handlers), test the *match* and *run* functions individually, you can inject fakes and stubs into these and verify their behavior.<br/>
Take note of [pr-conventional-title test cases](https://github.com/TomerFi/auto-me-bot/blob/main/tests/handlers/pr-conventional-title.test.js) which can be used as a template for future test cases as it's quite short, simple, and has full coverage.

### Integration Tests

The Lambda handler entrypoint is tested in [tests/app-runner.test.js](tests/app-runner.test.js).
These tests instantiate a real Probot instance with a generated RSA key, sign webhook payloads with HMAC-SHA256,
and verify the handler processes events without crashing.
Payloads are loaded from [tests/fixtures/](tests/fixtures/).

### Registering Handlers

> NOTE: registering handlers requires modifying existing code, the snippets in this section are meant to help you get around the code, and to be used as boiler-plate code.
Expand Down Expand Up @@ -208,6 +233,7 @@ This project includes Cursor-specific helpers:
- **run-tests-quick** - Quick test run without coverage
- **lint-fix** - Lint and auto-fix issues
- **serve-docs** - Serve documentation locally
- **smoke-test** - Run smoke tests against the live Lambda function

### Agents

Expand Down