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

Commita16963d

Browse files
committed
require setup, but not solution
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent83b72a2 commita16963d

File tree

1 file changed

+58
-1
lines changed

1 file changed

+58
-1
lines changed

‎tests/tutorial.test.ts

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ const validJson: Partial<T.Tutorial> = {
3737
{
3838
id:"1.1",
3939
content:"The first step",
40-
setup:{commits:[]},
40+
setup:{commits:["abcdefa"]},
41+
solution:{commits:["abcdefb"]},
4142
},
4243
],
4344
},
@@ -74,4 +75,60 @@ describe("validate tutorial", () => {
7475
constvalid=validateTutorial(json);
7576
expect(valid).toBe(true);
7677
});
78+
it("should allow a step with no solution",()=>{
79+
constjson={
80+
...validJson,
81+
levels:[
82+
{
83+
id:"1",
84+
title:"Level 1",
85+
summary:"summary",
86+
content:"content",
87+
steps:[
88+
{
89+
id:"1.1",
90+
content:"The first step",
91+
setup:{commits:["abcdefa"]},
92+
},
93+
{
94+
id:"1.2",
95+
content:"The second step",
96+
setup:{commits:["abcdefb"]},
97+
},
98+
],
99+
},
100+
],
101+
};
102+
103+
constvalid=validateTutorial(json);
104+
expect(valid).toBe(true);
105+
});
106+
it("shouldn't allow a step with no setup but a solution",()=>{
107+
constjson={
108+
...validJson,
109+
levels:[
110+
{
111+
id:"1",
112+
title:"Level 1",
113+
summary:"summary",
114+
content:"content",
115+
steps:[
116+
{
117+
id:"1.1",
118+
content:"The first step",
119+
solution:{commits:["abcdefa"]},
120+
},
121+
{
122+
id:"1.2",
123+
content:"The second step",
124+
solution:{commits:["abcdefb"]},
125+
},
126+
],
127+
},
128+
],
129+
};
130+
131+
constvalid=validateTutorial(json);
132+
expect(valid).toBe(false);
133+
});
77134
});

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp