@@ -1220,7 +1220,7 @@ test('stale issues should not be closed if days is set to -1', async () => {
1220
1220
} ) ;
1221
1221
1222
1222
test ( 'stale label should be removed if a comment was added to a stale issue' , async ( ) => {
1223
- const opts = { ...DefaultProcessorOptions , removeStaleWhenUpdated : true } ;
1223
+ const opts = { ...DefaultProcessorOptions , removeStaleWhenCommented : true } ;
1224
1224
const TestIssueList : Issue [ ] = [
1225
1225
generateIssue (
1226
1226
opts ,
@@ -1259,7 +1259,7 @@ test('when the option "labelsToAddWhenUnstale" is set, the labels should be adde
1259
1259
expect . assertions ( 4 ) ;
1260
1260
const opts = {
1261
1261
...DefaultProcessorOptions ,
1262
- removeStaleWhenUpdated : true ,
1262
+ removeStaleWhenCommented : true ,
1263
1263
labelsToAddWhenUnstale : 'test'
1264
1264
} ;
1265
1265
const TestIssueList : Issue [ ] = [
@@ -1299,8 +1299,37 @@ test('when the option "labelsToAddWhenUnstale" is set, the labels should be adde
1299
1299
expect ( processor . addedLabelIssues ) . toHaveLength ( 1 ) ;
1300
1300
} ) ;
1301
1301
1302
- test ( 'stale label should not be removed if a comment was added by the bot (and the issue should be closed) ' , async ( ) => {
1302
+ test ( 'stale label should be removed if a stale issue was updated ' , async ( ) => {
1303
1303
const opts = { ...DefaultProcessorOptions , removeStaleWhenUpdated : true } ;
1304
+ const TestIssueList : Issue [ ] = [
1305
+ generateIssue (
1306
+ opts ,
1307
+ 1 ,
1308
+ 'An issue that should un-stale' ,
1309
+ new Date ( ) . toDateString ( ) ,
1310
+ '2020-01-01T17:00:00Z' ,
1311
+ false ,
1312
+ [ 'Stale' ]
1313
+ )
1314
+ ] ;
1315
+ const processor = new IssuesProcessorMock (
1316
+ opts ,
1317
+ async ( ) => 'abot' ,
1318
+ async p => ( p === 1 ? TestIssueList : [ ] ) ,
1319
+ async ( ) => [ ] ,
1320
+ async ( ) => '2020-01-02T17:00:00Z'
1321
+ ) ;
1322
+
1323
+ // process our fake issue list
1324
+ await processor . processIssues ( 1 ) ;
1325
+
1326
+ expect ( processor . closedIssues ) . toHaveLength ( 0 ) ;
1327
+ expect ( processor . staleIssues ) . toHaveLength ( 0 ) ;
1328
+ expect ( processor . removedLabelIssues ) . toHaveLength ( 1 ) ;
1329
+ } ) ;
1330
+
1331
+ test ( 'stale label should not be removed if a comment was added by the bot (and the issue should be closed)' , async ( ) => {
1332
+ const opts = { ...DefaultProcessorOptions , removeStaleWhenCommented : true } ;
1304
1333
github . context . actor = 'abot' ;
1305
1334
const TestIssueList : Issue [ ] = [
1306
1335
generateIssue (
@@ -1339,7 +1368,7 @@ test('stale label should not be removed if a comment was added by the bot (and t
1339
1368
test ( 'stale label containing a space should be removed if a comment was added to a stale issue' , async ( ) => {
1340
1369
const opts : IIssuesProcessorOptions = {
1341
1370
...DefaultProcessorOptions ,
1342
- removeStaleWhenUpdated : true ,
1371
+ removeStaleWhenCommented : true ,
1343
1372
staleIssueLabel : 'stat: stale'
1344
1373
} ;
1345
1374
const TestIssueList : Issue [ ] = [
@@ -2278,7 +2307,7 @@ test('processing an issue stale since less than the daysBeforeStale with a stale
2278
2307
daysBeforeStale : 30 ,
2279
2308
daysBeforeClose : 7 ,
2280
2309
closeIssueMessage : 'close message' ,
2281
- removeStaleWhenUpdated : false
2310
+ removeStaleWhenCommented : false
2282
2311
} ;
2283
2312
const now : Date = new Date ( ) ;
2284
2313
const updatedAt : Date = new Date ( now . setDate ( now . getDate ( ) - 9 ) ) ;
@@ -2320,7 +2349,7 @@ test('processing an issue stale since less than the daysBeforeStale without a st
2320
2349
daysBeforeStale : 30 ,
2321
2350
daysBeforeClose : 7 ,
2322
2351
closeIssueMessage : 'close message' ,
2323
- removeStaleWhenUpdated : false
2352
+ removeStaleWhenCommented : false
2324
2353
} ;
2325
2354
const now : Date = new Date ( ) ;
2326
2355
const updatedAt : Date = new Date ( now . setDate ( now . getDate ( ) - 9 ) ) ;
0 commit comments