File tree Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,6 @@ module.exports = (app) => {
7575 } ;
7676
7777 // all finished?
78- console . log ( outstandingTasks ) ;
7978 if ( outstandingTasks . remaining === 0 ) {
8079 check . status = 'completed' ;
8180 check . conclusion = 'success' ;
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ module.exports = function (body) {
1313
1414 // return counts of task list items and how many are left to be completed
1515 return {
16- total : listItems . length ,
16+ total : listItems . filter ( item => item . checked !== undefined ) . length ,
1717 remaining : listItems . filter ( item => item . checked === false ) . length
1818 } ;
1919} ;
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ Hello World
1212 expect ( results . total ) . toBe ( 2 ) ;
1313 expect ( results . remaining ) . toBe ( 1 ) ;
1414} ) ;
15+
1516test ( 'Test no outstanding tasks' , ( ) => {
1617 let markdown = `
1718Hello World
@@ -22,3 +23,24 @@ Hello World
2223 expect ( results . total ) . toBe ( 2 ) ;
2324 expect ( results . remaining ) . toBe ( 0 ) ;
2425} ) ;
26+
27+ test ( 'Test no tasks' , ( ) => {
28+ let markdown = `
29+ Hello World
30+ ` ;
31+ let results = checkOutstandingTasks ( markdown ) ;
32+ expect ( results . total ) . toBe ( 0 ) ;
33+ expect ( results . remaining ) . toBe ( 0 ) ;
34+ } ) ;
35+
36+ test ( 'Test dont count normal lists' , ( ) => {
37+ let markdown = `
38+ Hello World
39+ - normal
40+ - [x] task 1
41+ - [ ] task 2
42+ ` ;
43+ let results = checkOutstandingTasks ( markdown ) ;
44+ expect ( results . total ) . toBe ( 2 ) ;
45+ expect ( results . remaining ) . toBe ( 1 ) ;
46+ } ) ;
You can’t perform that action at this time.
0 commit comments