File tree Expand file tree Collapse file tree 4 files changed +60
-4
lines changed Expand file tree Collapse file tree 4 files changed +60
-4
lines changed Original file line number Diff line number Diff line change 2222 "tmi.js" : " ^1.5.0"
2323 },
2424 "devDependencies" : {
25- "lodash" : " ^4.17.15" ,
2625 "@types/faker" : " ^4.1.11" ,
2726 "@types/hapi__hapi" : " ^19.0.2" ,
2827 "@types/hapi__joi" : " ^16.0.12" ,
3635 "husky" : " ^4.2.5" ,
3736 "jest" : " ^25.2.7" ,
3837 "lint-staged" : " >=10" ,
38+ "lodash" : " ^4.17.15" ,
3939 "nock" : " ^12.0.3" ,
4040 "nodemon" : " ^2.0.3" ,
4141 "prettier" : " ^2.0.4" ,
4242 "ts-jest" : " ^25.4.0" ,
43- "typescript" : " ^3.8.3"
43+ "typescript" : " ^3.8.3" ,
44+ "utility-types" : " ^3.10.0"
4445 }
4546}
Original file line number Diff line number Diff line change 11import { RepositoryWebhookPayload } from './repository-webhook-payload' ;
22
33export interface PullRequestPayload extends RepositoryWebhookPayload {
4- action : string ;
5- pull_request : { user : { login : string } ; merged ?: boolean } ;
4+ action :
5+ | 'assigned'
6+ | 'unassigned'
7+ | 'review_requested'
8+ | 'review_request_removed'
9+ | 'labeled'
10+ | 'unlabeled'
11+ | 'opened'
12+ | 'edited'
13+ | 'closed'
14+ | 'ready_for_review'
15+ | 'locked'
16+ | 'unlocked'
17+ | 'reopened' ;
18+ pull_request : { user : { login : string } ; merged ?: boolean ; html_url : string } ;
619}
Original file line number Diff line number Diff line change 1+ import { internet , random } from 'faker' ;
2+ import { merge } from 'lodash' ;
3+ import { PullRequestPayload } from '../../../src/schemas/github/pull-request-payload' ;
4+ import { DeepPartial } from 'utility-types' ;
5+
6+ export class PullRequestPayloadBuilder {
7+ private payload : PullRequestPayload = {
8+ action : random . arrayElement ( [
9+ 'assigned' ,
10+ 'unassigned' ,
11+ 'review_requested' ,
12+ 'review_request_removed' ,
13+ 'labeled' ,
14+ 'unlabeled' ,
15+ 'opened' ,
16+ 'edited' ,
17+ 'closed' ,
18+ 'ready_for_review' ,
19+ 'locked' ,
20+ 'unlocked' ,
21+ 'reopened' ,
22+ ] ) ,
23+ pull_request : { user : { login : internet . userName ( ) } , html_url : internet . url ( ) } ,
24+ repository : { html_url : internet . url ( ) , full_name : 'streamdevs/webhook' } ,
25+ sender : { login : internet . userName ( ) } ,
26+ } ;
27+
28+ public with ( payload : DeepPartial < PullRequestPayload > ) : PullRequestPayloadBuilder {
29+ merge ( this . payload , payload ) ;
30+
31+ return this ;
32+ }
33+
34+ public getInstance ( ) : PullRequestPayload {
35+ return this . payload ;
36+ }
37+ }
Original file line number Diff line number Diff line change @@ -5190,6 +5190,11 @@ util-deprecate@^1.0.1:
51905190 resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
51915191 integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=
51925192
5193+ utility-types@^3.10.0 :
5194+ version "3.10.0"
5195+ resolved "https://registry.yarnpkg.com/utility-types/-/utility-types-3.10.0.tgz#ea4148f9a741015f05ed74fd615e1d20e6bed82b"
5196+ integrity sha512-O11mqxmi7wMKCo6HKFt5AhO4BwY3VV68YU07tgxfz8zJTIxr4BpsezN49Ffwy9j3ZpwwJp4fkRwjRzq3uWE6Rg==
5197+
51935198uuid@^3.3.2 :
51945199 version "3.4.0"
51955200 resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
You can’t perform that action at this time.
0 commit comments