Skip to content

Commit

Permalink
Payload object explanation in documentation (#411)
Browse files Browse the repository at this point in the history
* Payload object explanation

* Little precision about event-name for probot simulate
  • Loading branch information
Raul6469 authored and bkeepers committed Feb 1, 2018
1 parent b85d6f3 commit d3a47ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/simulating-webhooks.md
Expand Up @@ -16,7 +16,9 @@ Next, simulate this event being delivered by running:

$ node_modules/.bin/probot simulate <event-name> <path-to-fixture> <path-to-app>

Note that `event-name` here is just the name of the event (like pull_request or issues) and not the action (like labeled). For example, to simulate the pull_request.labeled event, run:
Note that `event-name` here is just the name of the event (like pull_request or issues) and not the action (like labeled). You can find it in the GitHub deliveries history under the `X-GitHub-Event` header.

For example, to simulate the pull_request.labeled event, run:

$ node_modules/.bin/probot simulate pull_request test/fixtures/pull_request.labeled.json ./index.js

2 changes: 2 additions & 0 deletions docs/testing.md
Expand Up @@ -41,6 +41,8 @@ describe('your-app', () => {
describe('your functionality', () => {
it('performs an action', async () => {
// Simulates delivery of a payload
// payload.event is the X-GitHub-Event header sent by GitHub (for example "push")
// payload.payload is the actual payload body
await robot.receive(payload)
// This test would pass if in your main code you called `context.github.issues.createComment`
expect(github.issues.createComment).toHaveBeenCalled()
Expand Down

0 comments on commit d3a47ab

Please sign in to comment.