@@ -2,6 +2,7 @@ import { TwitchChat } from '../../../src/services/TwitchChat';
22import { StreamLabs } from '../../../src/services/StreamLabs' ;
33import { IssueOpened } from '../../../src/reactions/github/issue-opened' ;
44import { IssuePayload } from '../../../src/schemas/github/issue-payload' ;
5+ import { IssuePayloadBuilder } from '../../builders/github/issue-payload-builder' ;
56
67describe ( 'IssueOpened' , ( ) => {
78 let twitchChat : TwitchChat ;
@@ -16,16 +17,18 @@ describe('IssueOpened', () => {
1617 let payload : IssuePayload ;
1718
1819 beforeEach ( ( ) => {
19- payload = {
20- action : 'opened' ,
21- repository : {
22- html_url : 'https://github.com/streamdevs/webhook' ,
23- full_name : 'streamdevs/webhook' ,
24- } ,
25- sender : {
26- login : 'orestes' ,
27- } ,
28- } ;
20+ payload = new IssuePayloadBuilder ( )
21+ . with ( {
22+ action : 'opened' ,
23+ repository : {
24+ html_url : 'https://github.com/streamdevs/webhook' ,
25+ full_name : 'streamdevs/webhook' ,
26+ } ,
27+ sender : {
28+ login : 'orestes' ,
29+ } ,
30+ } )
31+ . getInstance ( ) ;
2932 } ) ;
3033
3134 it ( 'calls StreamLabs with the expected message' , async ( ) => {
@@ -44,7 +47,7 @@ describe('IssueOpened', () => {
4447 await subject . handle ( { payload } ) ;
4548
4649 expect ( twitchChat . send ) . toHaveBeenCalledWith (
47- `${ payload . sender . login } opened a issue in ${ payload . repository . html_url } ` ,
50+ `${ payload . sender . login } opened a issue in ${ payload . issue . html_url } ` ,
4851 ) ;
4952 } ) ;
5053 } ) ;
0 commit comments