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

Commit6627395

Browse files
committed
require an "id" for a tutorial
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent336e9fe commit6627395

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

‎src/schema/skeleton.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ export default {
77
...meta,
88
type:"object",
99
properties:{
10+
id:{
11+
type:"string",
12+
description:"A unique identifier for your tutorial. Currently no system to create this, so create your own for now",
13+
examples:["fcc-learn-npm"]
14+
},
15+
1016
version:{
1117
$ref:"#/definitions/semantic_version",
1218
description:"The tutorial version. Must be unique for the tutorial.",
@@ -253,5 +259,5 @@ export default {
253259
},
254260
},
255261
additionalProperties:false,
256-
required:["version","config","levels"],
262+
required:["id","version","config","levels"],
257263
};

‎src/schema/tutorial.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ export default {
77
...meta,
88
type:"object",
99
properties:{
10+
id:{
11+
type:"string",
12+
description:"A unique identifier for your tutorial. Currently no system to create this, so create your own for now",
13+
examples:["fcc-learn-npm"]
14+
},
15+
1016
version:{
1117
$ref:"#/definitions/semantic_version",
1218
description:"The tutorial version. Must be unique for the tutorial.",

‎tests/skeleton.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import skeletonSchema from '../src/schema/skeleton'
44
constvalidateSkeleton=(json:any)=>validateSchema(skeletonSchema,json)
55

66
constvalidJson={
7+
id:'coderoad-test',
78
version:'0.1.0',
89
config:{
910
testRunner:{
@@ -95,6 +96,13 @@ describe('validate skeleton', () => {
9596
constvalid=validateSkeleton(json)
9697
expect(valid).toBe(true)
9798
})
99+
it('should fail if id is missing',()=>{
100+
constjson={ ...validJson,id:undefined}
101+
102+
constvalid=validateSkeleton(json)
103+
expect(valid).toBe(false)
104+
})
105+
98106
it('should fail if version is invalid',()=>{
99107
constjson={ ...validJson,version:'NOT A VERSION'}
100108

‎tests/tutorial.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import tutorialSchema from '../src/schema/tutorial'
33
import{validateSchema}from'../src/utils/validateSchema'
44

55
constvalidJson:Partial<T.Tutorial>={
6+
id:'coderoad-test',
67
version:'0.1.0',
78
summary:{title:'Title',description:'Description'},
89
config:{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp