@@ -81,4 +81,49 @@ describe('auto-label-bot', () => {
81
81
82
82
scope . done ( ) ;
83
83
} ) ;
84
+
85
+ test ( 'add skipped label when issue title contains DISABLED test' , async ( ) => {
86
+ nock ( 'https://api.github.com' )
87
+ . post ( '/app/installations/2/access_tokens' )
88
+ . reply ( 200 , { token : 'test' } ) ;
89
+
90
+ const payload = require ( './fixtures/issues.opened' ) ;
91
+ payload [ 'issue' ] [ 'title' ] = 'DISABLED test_blah (__main__.TestClass)' ;
92
+ payload [ 'issue' ] [ 'labels' ] = [ ] ;
93
+
94
+ const scope = nock ( 'https://api.github.com' )
95
+ . post (
96
+ '/repos/ezyang/testing-ideal-computing-machine/issues/5/labels' ,
97
+ body => {
98
+ expect ( body ) . toMatchObject ( [ 'skipped' ] ) ;
99
+ return true ;
100
+ }
101
+ )
102
+ . reply ( 200 ) ;
103
+
104
+ await probot . receive ( { name : 'issues' , payload : payload , id : '2' } ) ;
105
+
106
+ scope . done ( ) ;
107
+ } ) ;
108
+
109
+ test ( 'add skipped label when PR title contains DISABLED test' , async ( ) => {
110
+ nock ( 'https://api.github.com' )
111
+ . post ( '/app/installations/2/access_tokens' )
112
+ . reply ( 200 , { token : 'test' } ) ;
113
+
114
+ const payload = require ( './fixtures/pull_request.opened' ) [ 'payload' ] ;
115
+ payload [ 'pull_request' ] [ 'title' ] = 'DISABLED test_blah (__main__.TestClass)' ;
116
+ payload [ 'pull_request' ] [ 'labels' ] = [ ] ;
117
+
118
+ const scope = nock ( 'https://api.github.com' )
119
+ . post ( '/repos/zhouzhuojie/gha-ci-playground/issues/31/labels' , body => {
120
+ expect ( body ) . toMatchObject ( [ 'skipped' ] ) ;
121
+ return true ;
122
+ } )
123
+ . reply ( 200 ) ;
124
+
125
+ await probot . receive ( { name : 'pull_request' , payload : payload , id : '2' } ) ;
126
+
127
+ scope . done ( ) ;
128
+ } ) ;
84
129
} ) ;
0 commit comments