@@ -36,7 +36,7 @@ const DefaultProcessorOptions: IssueProcessorOptions = {
3636 staleIssueMessage : 'This issue is stale' ,
3737 stalePrMessage : 'This PR is stale' ,
3838 daysBeforeStale : 1 ,
39- daysBeforeClose : 1 ,
39+ daysBeforeClose : 30 ,
4040 staleIssueLabel : 'Stale' ,
4141 exemptIssueLabels : '' ,
4242 stalePrLabel : 'Stale' ,
@@ -62,7 +62,7 @@ test('empty issue list results in 1 operation', async () => {
6262 expect ( operationsLeft ) . toEqual ( 99 ) ;
6363} ) ;
6464
65- test ( 'processing an issue with no label will make it stale' , async ( ) => {
65+ test ( 'processing an issue with no label will make it stale and close it, if it is old enough ' , async ( ) => {
6666 const TestIssueList : Issue [ ] = [
6767 generateIssue ( 1 , 'An issue with no label' , '2020-01-01T17:00:00Z' )
6868 ] ;
@@ -77,6 +77,30 @@ test('processing an issue with no label will make it stale', async () => {
7777 // process our fake issue list
7878 await processor . processIssues ( 1 ) ;
7979
80+ expect ( processor . staleIssues . length ) . toEqual ( 1 ) ;
81+ expect ( processor . closedIssues . length ) . toEqual ( 1 ) ;
82+ } ) ;
83+
84+ test ( 'processing an issue with no label will make it stale but not close it' , async ( ) => {
85+ // issue should be from 2 days ago so it will be
86+ // stale but not close-able, based on default settings
87+ let issueDate = new Date ( ) ;
88+ issueDate . setDate ( issueDate . getDate ( ) - 2 ) ;
89+
90+ const TestIssueList : Issue [ ] = [
91+ generateIssue ( 1 , 'An issue with no label' , issueDate . toDateString ( ) )
92+ ] ;
93+
94+ const processor = new IssueProcessor (
95+ DefaultProcessorOptions ,
96+ async p => ( p == 1 ? TestIssueList : [ ] ) ,
97+ async ( num , dt ) => [ ] ,
98+ async ( issue , label ) => new Date ( ) . toDateString ( )
99+ ) ;
100+
101+ // process our fake issue list
102+ await processor . processIssues ( 1 ) ;
103+
80104 expect ( processor . staleIssues . length ) . toEqual ( 1 ) ;
81105 expect ( processor . closedIssues . length ) . toEqual ( 0 ) ;
82106} ) ;
0 commit comments