Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit53cf62c

Browse files
committed
large smoke test
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent029e1cd commit53cf62c

File tree

2 files changed

+174
-2
lines changed

2 files changed

+174
-2
lines changed

‎src/utils/parse.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ export function parseMdContent(md: string): TutorialFrame | never {
6767
//@ts-ignore
6868
mdContent.levels[levelId]={
6969
id:levelId,
70-
title:levelTitle,
70+
title:levelTitle.trim(),
7171
summary:levelSummary
7272
?levelSummary.trim()
73-
:_.truncate(levelContent,{length:80,omission:"..."}),
73+
:_.truncate(levelContent.trim(),{length:80,omission:"..."}),
7474
content:levelContent.trim(),
7575
};
7676
}else{

‎tests/parse.test.ts

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,178 @@ The first step
437437
expect(result.levels[0].steps[0]).toEqual(expected.levels[0].steps[0]);
438438
});
439439

440+
it("should load the full config for a step",()=>{
441+
constmd=`# Title
442+
443+
Description.
444+
445+
## L1 Title 1
446+
447+
First level content.
448+
449+
### L1S1
450+
451+
The first step
452+
453+
### L1S2
454+
455+
The second step
456+
457+
## L2 Title 2
458+
459+
Second level content.
460+
461+
### L2S1
462+
463+
The third step
464+
`;
465+
constconfig={
466+
levels:[
467+
{
468+
id:"L1",
469+
steps:[
470+
{
471+
id:"L1S1",
472+
setup:{
473+
commands:["npm install"],
474+
files:["someFile.js"],
475+
watchers:["someFile.js"],
476+
filter:"someFilter",
477+
subtasks:true,
478+
},
479+
solution:{
480+
commands:["npm install"],
481+
files:["someFile.js"],
482+
},
483+
},
484+
{
485+
id:"L1S2",
486+
setup:{
487+
commands:["npm install"],
488+
files:["someFile.js"],
489+
watchers:["someFile.js"],
490+
filter:"someFilter",
491+
subtasks:true,
492+
},
493+
solution:{
494+
commands:["npm install"],
495+
files:["someFile.js"],
496+
},
497+
},
498+
],
499+
},
500+
{
501+
id:"L2",
502+
summary:"Second level content.",
503+
content:"First level content.",
504+
steps:[
505+
{
506+
id:"L2S1",
507+
setup:{
508+
commands:["npm install"],
509+
files:["someFile.js"],
510+
watchers:["someFile.js"],
511+
filter:"someFilter",
512+
subtasks:true,
513+
},
514+
solution:{
515+
commands:["npm install"],
516+
files:["someFile.js"],
517+
},
518+
},
519+
],
520+
},
521+
],
522+
};
523+
constresult=parse({
524+
text:md,
525+
config,
526+
commits:{
527+
L1S1Q:["abcdefg1","123456789"],
528+
L1S1A:["1gfedcba","987654321"],
529+
L1S2Q:["2abcdefg"],
530+
L1S2A:["3abcdefg"],
531+
L2S1Q:["4abcdefg"],
532+
L2S1A:["5abcdefg"],
533+
},
534+
});
535+
constexpected={
536+
summary:{
537+
description:"Description.",
538+
},
539+
levels:[
540+
{
541+
id:"L1",
542+
title:"Title 1",
543+
summary:"First level content.",
544+
content:"First level content.",
545+
steps:[
546+
{
547+
id:"L1S1",
548+
content:"The first step",
549+
setup:{
550+
commits:["abcdefg1","123456789"],
551+
commands:["npm install"],
552+
files:["someFile.js"],
553+
watchers:["someFile.js"],
554+
filter:"someFilter",
555+
subtasks:true,
556+
},
557+
solution:{
558+
commits:["1gfedcba","987654321"],
559+
commands:["npm install"],
560+
files:["someFile.js"],
561+
},
562+
},
563+
{
564+
id:"L1S2",
565+
content:"The second step",
566+
setup:{
567+
commits:["2abcdefg"],
568+
commands:["npm install"],
569+
files:["someFile.js"],
570+
watchers:["someFile.js"],
571+
filter:"someFilter",
572+
subtasks:true,
573+
},
574+
solution:{
575+
commits:["3abcdefg"],
576+
commands:["npm install"],
577+
files:["someFile.js"],
578+
},
579+
},
580+
],
581+
},
582+
{
583+
id:"L2",
584+
title:"Title 2",
585+
summary:"Second level content.",
586+
content:"Second level content.",
587+
steps:[
588+
{
589+
id:"L2S1",
590+
content:"The third step",
591+
setup:{
592+
commits:["4abcdefg"],
593+
commands:["npm install"],
594+
files:["someFile.js"],
595+
watchers:["someFile.js"],
596+
filter:"someFilter",
597+
subtasks:true,
598+
},
599+
solution:{
600+
commits:["5abcdefg"],
601+
commands:["npm install"],
602+
files:["someFile.js"],
603+
},
604+
},
605+
],
606+
},
607+
],
608+
};
609+
expect(result.levels).toEqual(expected.levels);
610+
});
611+
440612
// config
441613
it("should parse the tutorial config",()=>{
442614
constmd=`# Title

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp