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

Commit429cdf8

Browse files
committed
skeleton validation tests
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent8cd8a88 commit429cdf8

File tree

1 file changed

+183
-15
lines changed

1 file changed

+183
-15
lines changed

‎tests/skeleton.test.ts

Lines changed: 183 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,187 @@ describe("validate skeleton", () => {
8484
constvalid=validateSkeleton(json);
8585
expect(valid).toBe(true);
8686
});
87-
it.todo("should fail if version is invalid");
88-
it.todo("should fail if version is missing");
89-
it.todo("should fail if config is missing");
90-
it.todo("should fail if config testRunner is missing");
91-
it.todo("should fail if config testRunner command is missing");
92-
it.todo("should fail if config testRunner args tap is missing");
93-
it.todo("should fail if repo is missing");
94-
it.todo("should fail if repo uri is missing");
95-
it.todo("should fail if repo uri is invalid");
96-
it.todo("should fail if repo branch is missing");
97-
it.todo("should fial if level is missing id");
98-
it.todo("should fail if level setup is invalid");
99-
it.todo("should fail if step is missing id");
100-
it.todo("should fail if step setup is invalid");
101-
it.todo("should fail if solution setup is invalid");
87+
it("should fail if version is invalid",()=>{
88+
constjson={ ...validJson,version:"NOT A VERSION"};
89+
90+
constvalid=validateSkeleton(json);
91+
expect(valid).toBe(false);
92+
});
93+
it("should fail if version is missing",()=>{
94+
constjson={ ...validJson,version:undefined};
95+
96+
constvalid=validateSkeleton(json);
97+
expect(valid).toBe(false);
98+
});
99+
it("should fail if config is missing",()=>{
100+
constjson={ ...validJson,config:undefined};
101+
102+
constvalid=validateSkeleton(json);
103+
expect(valid).toBe(false);
104+
});
105+
it("should fail if config testRunner is missing",()=>{
106+
constjson={
107+
...validJson,
108+
config:{ ...validJson.config,testRunner:undefined},
109+
};
110+
111+
constvalid=validateSkeleton(json);
112+
expect(valid).toBe(false);
113+
});
114+
it("should fail if config testRunner command is missing",()=>{
115+
constjson={
116+
...validJson,
117+
config:{
118+
...validJson.config,
119+
testRunner:{ ...validJson.config.testRunner,command:undefined},
120+
},
121+
};
122+
123+
constvalid=validateSkeleton(json);
124+
expect(valid).toBe(false);
125+
});
126+
it("should fail if config testRunner args tap is missing",()=>{
127+
constjson={
128+
...validJson,
129+
config:{
130+
...validJson.config,
131+
testRunner:{
132+
...validJson.config.testRunner,
133+
args:{ ...validJson.config.testRunner.args,tap:undefined},
134+
},
135+
},
136+
};
137+
138+
constvalid=validateSkeleton(json);
139+
expect(valid).toBe(false);
140+
});
141+
it("should fail if repo is missing",()=>{
142+
constjson={
143+
...validJson,
144+
config:{
145+
...validJson.config,
146+
repo:undefined,
147+
},
148+
};
149+
150+
constvalid=validateSkeleton(json);
151+
expect(valid).toBe(false);
152+
});
153+
it("should fail if repo uri is missing",()=>{
154+
constjson={
155+
...validJson,
156+
config:{
157+
...validJson.config,
158+
repo:{ ...validJson.config.repo,uri:undefined},
159+
},
160+
};
161+
162+
constvalid=validateSkeleton(json);
163+
expect(valid).toBe(false);
164+
});
165+
it("should fail if repo uri is invalid",()=>{
166+
constjson={
167+
...validJson,
168+
config:{
169+
...validJson.config,
170+
repo:{ ...validJson.config.repo,uri:"NOT A VALID URI"},
171+
},
172+
};
173+
174+
constvalid=validateSkeleton(json);
175+
expect(valid).toBe(false);
176+
});
177+
it("should fail if repo branch is missing",()=>{
178+
constjson={
179+
...validJson,
180+
config:{
181+
...validJson.config,
182+
repo:{ ...validJson.config.repo,branch:undefined},
183+
},
184+
};
185+
186+
constvalid=validateSkeleton(json);
187+
expect(valid).toBe(false);
188+
});
189+
it("should fial if level is missing id",()=>{
190+
constlevel1={ ...validJson.levels[0],id:undefined};
191+
constjson={
192+
...validJson,
193+
levels:[level1],
194+
};
195+
196+
constvalid=validateSkeleton(json);
197+
expect(valid).toBe(false);
198+
});
199+
it("should fail if level setup is invalid",()=>{
200+
constlevel1={ ...validJson.levels[0],setup:{invalidThing:[]}};
201+
constjson={
202+
...validJson,
203+
levels:[level1],
204+
};
205+
206+
constvalid=validateSkeleton(json);
207+
expect(valid).toBe(false);
208+
});
209+
it("should fail if step is missing id",()=>{
210+
conststep1={ ...validJson.levels[0].steps[0],id:undefined};
211+
constlevel1={ ...validJson.levels[0],steps:[step1]};
212+
constjson={
213+
...validJson,
214+
levels:[level1],
215+
};
216+
217+
constvalid=validateSkeleton(json);
218+
expect(valid).toBe(false);
219+
});
220+
it("should fail if step setup is missing",()=>{
221+
conststep1={ ...validJson.levels[0].steps[0],setup:undefined};
222+
constlevel1={ ...validJson.levels[0],steps:[step1]};
223+
constjson={
224+
...validJson,
225+
levels:[level1],
226+
};
227+
228+
constvalid=validateSkeleton(json);
229+
expect(valid).toBe(false);
230+
});
231+
it("should fail if step setup is invalid",()=>{
232+
conststep1={
233+
...validJson.levels[0].steps[0],
234+
setup:{invalidThing:[]},
235+
};
236+
constlevel1={ ...validJson.levels[0],steps:[step1]};
237+
constjson={
238+
...validJson,
239+
levels:[level1],
240+
};
241+
242+
constvalid=validateSkeleton(json);
243+
expect(valid).toBe(false);
244+
});
245+
it("should not fail if step solution is missing",()=>{
246+
conststep1={ ...validJson.levels[0].steps[0],solution:undefined};
247+
constlevel1={ ...validJson.levels[0],steps:[step1]};
248+
constjson={
249+
...validJson,
250+
levels:[level1],
251+
};
252+
253+
constvalid=validateSkeleton(json);
254+
expect(valid).toBe(true);
255+
});
256+
it("should fail if step solution is invalid",()=>{
257+
conststep1={
258+
...validJson.levels[0].steps[0],
259+
solution:{invalidThing:[]},
260+
};
261+
constlevel1={ ...validJson.levels[0],steps:[step1]};
262+
constjson={
263+
...validJson,
264+
levels:[level1],
265+
};
266+
267+
constvalid=validateSkeleton(json);
268+
expect(valid).toBe(false);
269+
});
102270
});

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp