Skip to content

Commit 7ac3d50

Browse files
added missing PublicPayload test
1 parent 7f580b1 commit 7ac3d50

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

github/payload.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,9 @@ type ProjectPayload struct {
472472

473473
// PublicPayload contains the information for GitHub's public hook event
474474
type PublicPayload struct {
475-
Repository Repository `json:"repository"`
476-
Sender User `json:"sender"`
475+
Repository Repository `json:"repository"`
476+
Sender User `json:"sender"`
477+
Installation Installation `json:"installation"`
477478
}
478479

479480
// PullRequestPayload contains the information for GitHub's pull_request hook event

github/payload_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,11 @@ func TestPayloads(t *testing.T) {
154154
filename: "project.json",
155155
typ: &ProjectPayload{},
156156
},
157+
{
158+
name: "PublicPayload",
159+
filename: "public.json",
160+
typ: &PublicPayload{},
161+
},
157162
{
158163
name: "PullRequestReviewCommentPayload",
159164
filename: "pull-request-review-comment.json",
@@ -221,8 +226,10 @@ func TestPayloads(t *testing.T) {
221226
t.Parallel()
222227
payload, err := ioutil.ReadFile(pth.Join("../testdata/github", tc.filename))
223228
assert.NoError(err)
229+
224230
parsedPayload, err := ParsePayload(string(payload), tc.typ)
225231
assert.NoError(err)
232+
226233
a, _ := jd.ReadJsonString(string(payload))
227234
b, _ := jd.ReadJsonString(parsedPayload)
228235
diff := a.Diff(b).Render()

scrape/github.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func write(folder string, example ExamplePayload) error {
115115
}
116116
func main() {
117117
collected := collect()
118-
fmt.Printf("Found %s examle payloads. \n", len(collected))
118+
fmt.Printf("Found %d examle payloads. \n", len(collected))
119119
root, _ := os.Getwd()
120120
folder := path.Join(root, "testdata/github")
121121
if _, err := os.Stat(folder); os.IsNotExist(err) {

0 commit comments

Comments
 (0)