@@ -13,6 +13,42 @@ test("single todo element should return itself", () => {
1313 expect ( result ) . toStrictEqual ( todos ) ;
1414} ) ;
1515
16+ test ( "single incomplete element should return itself" , ( ) => {
17+ // GIVEN
18+ const lines = [ "- [/] tada" ] ;
19+
20+ // WHEN
21+ const result = getTodos ( { lines } ) ;
22+
23+ // THEN
24+ const todos = [ "- [/] tada" ] ;
25+ expect ( result ) . toStrictEqual ( todos ) ;
26+ } ) ;
27+
28+ test ( "single done todo element should not return itself" , ( ) => {
29+ // GIVEN
30+ const lines = [ "- [x] tada" ] ;
31+
32+ // WHEN
33+ const result = getTodos ( { lines } ) ;
34+
35+ // THEN
36+ const todos = [ "" ] ;
37+ expect ( result ) . toStrictEqual ( todos ) ;
38+ } ) ;
39+
40+ test ( "single canceled todo element should not return itself" , ( ) => {
41+ // GIVEN
42+ const lines = [ "- [-] tada" ] ;
43+
44+ // WHEN
45+ const result = getTodos ( { lines } ) ;
46+
47+ // THEN
48+ const todos = [ "" ] ;
49+ expect ( result ) . toStrictEqual ( todos ) ;
50+ } ) ;
51+
1652test ( "get todos with children" , function ( ) {
1753 // GIVEN
1854 const lines = [
@@ -142,6 +178,35 @@ test("get todos without children", () => {
142178 expect ( todos ) . toStrictEqual ( result ) ;
143179} ) ;
144180
181+ test ( "get todos with correct alternate checkbox children" , function ( ) {
182+ // GIVEN
183+ const lines = [
184+ "- [ ] TODO" ,
185+ " - [ ] Next" ,
186+ " - [x] Completed task" ,
187+ " - some stuff" ,
188+ "- [ ] Another one" ,
189+ " - [ ] Another child" ,
190+ " - [/] More children" ,
191+ " - another child" ,
192+ "- this isn't copied" ,
193+ ] ;
194+
195+ // WHEN
196+ const todos = getTodos ( { lines : lines , withChildren : true } ) ;
197+
198+ // THEN
199+ const result = [
200+ "- [ ] TODO" ,
201+ " - [ ] Next" ,
202+ " - some stuff" ,
203+ "- [ ] Another one" ,
204+ " - [ ] Another child" ,
205+ " - [/] More children" ,
206+ " - another child" ,
207+ ] ;
208+ expect ( todos ) . toStrictEqual ( result ) ;
209+ } ) ;
145210test ( "get todos with children doesn't fail if child at end of list" , ( ) => {
146211 // GIVEN
147212 const lines = [
0 commit comments