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

require an "id" for a tutorial#93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 1 commit intomasterfromfeature/add-id-requirement
Jan 14, 2022
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
require an "id" for a tutorial
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
@ShMcK
ShMcK committedJan 14, 2022
commit662739575b938f61d67cce8cfaeb2683066b745a
8 changes: 7 additions & 1 deletionsrc/schema/skeleton.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,12 @@ export default {
...meta,
type: "object",
properties: {
id: {
type: "string",
description: "A unique identifier for your tutorial. Currently no system to create this, so create your own for now",
examples: ["fcc-learn-npm"]
},

version: {
$ref: "#/definitions/semantic_version",
description: "The tutorial version. Must be unique for the tutorial.",
Expand DownExpand Up@@ -253,5 +259,5 @@ export default {
},
},
additionalProperties: false,
required: ["version", "config", "levels"],
required: ["id", "version", "config", "levels"],
};
6 changes: 6 additions & 0 deletionssrc/schema/tutorial.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,12 @@ export default {
...meta,
type: "object",
properties: {
id: {
type: "string",
description: "A unique identifier for your tutorial. Currently no system to create this, so create your own for now",
examples: ["fcc-learn-npm"]
},

version: {
$ref: "#/definitions/semantic_version",
description: "The tutorial version. Must be unique for the tutorial.",
Expand Down
8 changes: 8 additions & 0 deletionstests/skeleton.test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,7 @@ import skeletonSchema from '../src/schema/skeleton'
const validateSkeleton = (json: any) => validateSchema(skeletonSchema, json)

const validJson = {
id: 'coderoad-test',
version: '0.1.0',
config: {
testRunner: {
Expand DownExpand Up@@ -95,6 +96,13 @@ describe('validate skeleton', () => {
const valid = validateSkeleton(json)
expect(valid).toBe(true)
})
it('should fail if id is missing', () => {
const json = { ...validJson, id: undefined }

const valid = validateSkeleton(json)
expect(valid).toBe(false)
})

it('should fail if version is invalid', () => {
const json = { ...validJson, version: 'NOT A VERSION' }

Expand Down
1 change: 1 addition & 0 deletionstests/tutorial.test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,6 +3,7 @@ import tutorialSchema from '../src/schema/tutorial'
import { validateSchema } from '../src/utils/validateSchema'

const validJson: Partial<T.Tutorial> = {
id: 'coderoad-test',
version: '0.1.0',
summary: { title: 'Title', description: 'Description' },
config: {
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp