@@ -541,7 +541,6 @@ The first step
541541files :[ "someFile.js" ] ,
542542watchers :[ "someFile.js" ] ,
543543filter :"someFilter" ,
544- subtasks :true ,
545544} ,
546545solution :{
547546commands :[ "npm install" ] ,
@@ -579,7 +578,6 @@ The first step
579578files :[ "someFile.js" ] ,
580579watchers :[ "someFile.js" ] ,
581580filter :"someFilter" ,
582- subtasks :true ,
583581} ,
584582solution :{
585583commits :[ "1gfedcba" , "987654321" ] ,
@@ -631,7 +629,6 @@ The third step
631629files :[ "someFile.js" ] ,
632630watchers :[ "someFile.js" ] ,
633631filter :"someFilter" ,
634- subtasks :true ,
635632} ,
636633solution :{
637634commands :[ "npm install" ] ,
@@ -645,7 +642,6 @@ The third step
645642files :[ "someFile.js" ] ,
646643watchers :[ "someFile.js" ] ,
647644filter :"someFilter" ,
648- subtasks :true ,
649645} ,
650646solution :{
651647commands :[ "npm install" ] ,
@@ -666,7 +662,6 @@ The third step
666662files :[ "someFile.js" ] ,
667663watchers :[ "someFile.js" ] ,
668664filter :"someFilter" ,
669- subtasks :true ,
670665} ,
671666solution :{
672667commands :[ "npm install" ] ,
@@ -709,7 +704,6 @@ The third step
709704files :[ "someFile.js" ] ,
710705watchers :[ "someFile.js" ] ,
711706filter :"someFilter" ,
712- subtasks :true ,
713707} ,
714708solution :{
715709commits :[ "1fedcba" , "987654321" ] ,
@@ -726,7 +720,6 @@ The third step
726720files :[ "someFile.js" ] ,
727721watchers :[ "someFile.js" ] ,
728722filter :"someFilter" ,
729- subtasks :true ,
730723} ,
731724solution :{
732725commits :[ "3abcdef" ] ,
@@ -751,7 +744,6 @@ The third step
751744files :[ "someFile.js" ] ,
752745watchers :[ "someFile.js" ] ,
753746filter :"someFilter" ,
754- subtasks :true ,
755747} ,
756748solution :{
757749commits :[ "5abcdef" ] ,
@@ -1419,4 +1411,74 @@ The second uninterrupted step
14191411expect ( result . levels [ 0 ] ) . toEqual ( expected . levels [ 0 ] ) ;
14201412} ) ;
14211413} ) ;
1414+ describe ( "subtasks" , ( ) => {
1415+ it ( "should parse subtasks" , ( ) => {
1416+ const md = `# Subtask Demo
1417+
1418+ A demo demonstrating how to use subtasks
1419+
1420+ ## 1. Subtask Example
1421+
1422+ A subtask example
1423+
1424+ ### 1.1
1425+
1426+ Create a function \`add\` that can take a variety of params.
1427+
1428+ #### SUBTASKS
1429+
1430+ - Add one number
1431+ - Add two numbers
1432+ - Add three numbers` ;
1433+ const skeleton = {
1434+ levels :[
1435+ {
1436+ id :"1" ,
1437+ steps :[
1438+ {
1439+ id :"1.1" ,
1440+ } ,
1441+ ] ,
1442+ } ,
1443+ ] ,
1444+ } ;
1445+ const expected = {
1446+ levels :[
1447+ {
1448+ id :"1" ,
1449+ title :"Subtask Example" ,
1450+ summary :"A subtask example" ,
1451+ content :"A subtask example" ,
1452+ steps :[
1453+ {
1454+ id :"1.1" ,
1455+ setup :{
1456+ subtasks :[
1457+ "Add one number" ,
1458+ "Add two numbers" ,
1459+ "Add three numbers" ,
1460+ ] ,
1461+ commits :[ "abcdef1" ] ,
1462+ } ,
1463+ content :
1464+ "Create a function `add` that can take a variety of params." ,
1465+ solution :{
1466+ commits :[ "abcdef2" ] ,
1467+ } ,
1468+ } ,
1469+ ] ,
1470+ } ,
1471+ ] ,
1472+ } ;
1473+ const result = parse ( {
1474+ text :md ,
1475+ skeleton,
1476+ commits :{
1477+ "1.1:T" :[ "abcdef1" ] ,
1478+ "1.1:S" :[ "abcdef2" ] ,
1479+ } ,
1480+ } ) ;
1481+ expect ( result . levels ) . toEqual ( expected . levels ) ;
1482+ } ) ;
1483+ } ) ;
14221484} ) ;