File tree Expand file tree Collapse file tree 1 file changed +102
-0
lines changed Expand file tree Collapse file tree 1 file changed +102
-0
lines changed Original file line number Diff line number Diff line change @@ -837,6 +837,108 @@ The first step
837837 } ) ;
838838 } ) ;
839839
840+ it ( "should load when commits are not in direct order (100, 200, 201)" , ( ) => {
841+ const md = `# Title
842+
843+ Description.
844+
845+ ## 100. Title
846+
847+ First line
848+
849+ ### 100.1
850+
851+ The first step
852+
853+ ## 200. Title
854+
855+ First line
856+
857+ ### 200.1
858+
859+ The first step
860+
861+ ## 201. Title
862+
863+ First line
864+
865+ ### 201.1
866+
867+ The first step
868+ ` ;
869+ const skeleton = {
870+ levels : [
871+ {
872+ id : "100" ,
873+ steps : [ { id : "100.1" } ] ,
874+ } ,
875+ {
876+ id : "200" ,
877+ steps : [ { id : "200.1" } ] ,
878+ } ,
879+ {
880+ id : "201" ,
881+ steps : [ { id : "201.1" } ] ,
882+ } ,
883+ ] ,
884+ } ;
885+ const result = parse ( {
886+ text : md ,
887+ skeleton,
888+ commits : { } ,
889+ } ) ;
890+ const expected = {
891+ summary : {
892+ description : "Description." ,
893+ } ,
894+ levels : [
895+ {
896+ id : "100" ,
897+ summary : "First line" ,
898+ content : "First line" ,
899+ steps : [
900+ {
901+ id : "100.1" ,
902+ content : "The first step" ,
903+ setup : {
904+ commits : [ ] ,
905+ } ,
906+ } ,
907+ ] ,
908+ } ,
909+ {
910+ id : "200" ,
911+ summary : "Second line" ,
912+ content : "Second line" ,
913+ steps : [
914+ {
915+ id : "200.1" ,
916+ content : "The second step" ,
917+ setup : {
918+ commits : [ ] ,
919+ } ,
920+ } ,
921+ ] ,
922+ } ,
923+ {
924+ id : "201" ,
925+ summary : "Third line" ,
926+ content : "Third line" ,
927+ steps : [
928+ {
929+ id : "201.1" ,
930+ content : "The third step" ,
931+ setup : {
932+ commits : [ ] ,
933+ } ,
934+ } ,
935+ ] ,
936+ } ,
937+ ] ,
938+ } ;
939+ expect ( result . levels ) . toEqual ( expected . levels ) ;
940+ } ) ;
941+
840942 describe ( "config" , ( ) => {
841943 it ( "should parse the tutorial config" , ( ) => {
842944 const md = `# Title
You can’t perform that action at this time.
0 commit comments