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

Validate yaml#28

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 9 commits intomasterfromvalidate-yaml
Jun 7, 2020
Merged
Changes from1 commit
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
PrevPrevious commit
NextNext commit
skeleton validation tests
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
@ShMcK
ShMcK committedJun 7, 2020
commit429cdf8398f39637fd9b32816d4381bd285b763a
198 changes: 183 additions & 15 deletionstests/skeleton.test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -84,19 +84,187 @@ describe("validate skeleton", () => {
const valid = validateSkeleton(json);
expect(valid).toBe(true);
});
it.todo("should fail if version is invalid");
it.todo("should fail if version is missing");
it.todo("should fail if config is missing");
it.todo("should fail if config testRunner is missing");
it.todo("should fail if config testRunner command is missing");
it.todo("should fail if config testRunner args tap is missing");
it.todo("should fail if repo is missing");
it.todo("should fail if repo uri is missing");
it.todo("should fail if repo uri is invalid");
it.todo("should fail if repo branch is missing");
it.todo("should fial if level is missing id");
it.todo("should fail if level setup is invalid");
it.todo("should fail if step is missing id");
it.todo("should fail if step setup is invalid");
it.todo("should fail if solution setup is invalid");
it("should fail if version is invalid", () => {
const json = { ...validJson, version: "NOT A VERSION" };

const valid = validateSkeleton(json);
expect(valid).toBe(false);
});
it("should fail if version is missing", () => {
const json = { ...validJson, version: undefined };

const valid = validateSkeleton(json);
expect(valid).toBe(false);
});
it("should fail if config is missing", () => {
const json = { ...validJson, config: undefined };

const valid = validateSkeleton(json);
expect(valid).toBe(false);
});
it("should fail if config testRunner is missing", () => {
const json = {
...validJson,
config: { ...validJson.config, testRunner: undefined },
};

const valid = validateSkeleton(json);
expect(valid).toBe(false);
});
it("should fail if config testRunner command is missing", () => {
const json = {
...validJson,
config: {
...validJson.config,
testRunner: { ...validJson.config.testRunner, command: undefined },
},
};

const valid = validateSkeleton(json);
expect(valid).toBe(false);
});
it("should fail if config testRunner args tap is missing", () => {
const json = {
...validJson,
config: {
...validJson.config,
testRunner: {
...validJson.config.testRunner,
args: { ...validJson.config.testRunner.args, tap: undefined },
},
},
};

const valid = validateSkeleton(json);
expect(valid).toBe(false);
});
it("should fail if repo is missing", () => {
const json = {
...validJson,
config: {
...validJson.config,
repo: undefined,
},
};

const valid = validateSkeleton(json);
expect(valid).toBe(false);
});
it("should fail if repo uri is missing", () => {
const json = {
...validJson,
config: {
...validJson.config,
repo: { ...validJson.config.repo, uri: undefined },
},
};

const valid = validateSkeleton(json);
expect(valid).toBe(false);
});
it("should fail if repo uri is invalid", () => {
const json = {
...validJson,
config: {
...validJson.config,
repo: { ...validJson.config.repo, uri: "NOT A VALID URI" },
},
};

const valid = validateSkeleton(json);
expect(valid).toBe(false);
});
it("should fail if repo branch is missing", () => {
const json = {
...validJson,
config: {
...validJson.config,
repo: { ...validJson.config.repo, branch: undefined },
},
};

const valid = validateSkeleton(json);
expect(valid).toBe(false);
});
it("should fial if level is missing id", () => {
const level1 = { ...validJson.levels[0], id: undefined };
const json = {
...validJson,
levels: [level1],
};

const valid = validateSkeleton(json);
expect(valid).toBe(false);
});
it("should fail if level setup is invalid", () => {
const level1 = { ...validJson.levels[0], setup: { invalidThing: [] } };
const json = {
...validJson,
levels: [level1],
};

const valid = validateSkeleton(json);
expect(valid).toBe(false);
});
it("should fail if step is missing id", () => {
const step1 = { ...validJson.levels[0].steps[0], id: undefined };
const level1 = { ...validJson.levels[0], steps: [step1] };
const json = {
...validJson,
levels: [level1],
};

const valid = validateSkeleton(json);
expect(valid).toBe(false);
});
it("should fail if step setup is missing", () => {
const step1 = { ...validJson.levels[0].steps[0], setup: undefined };
const level1 = { ...validJson.levels[0], steps: [step1] };
const json = {
...validJson,
levels: [level1],
};

const valid = validateSkeleton(json);
expect(valid).toBe(false);
});
it("should fail if step setup is invalid", () => {
const step1 = {
...validJson.levels[0].steps[0],
setup: { invalidThing: [] },
};
const level1 = { ...validJson.levels[0], steps: [step1] };
const json = {
...validJson,
levels: [level1],
};

const valid = validateSkeleton(json);
expect(valid).toBe(false);
});
it("should not fail if step solution is missing", () => {
const step1 = { ...validJson.levels[0].steps[0], solution: undefined };
const level1 = { ...validJson.levels[0], steps: [step1] };
const json = {
...validJson,
levels: [level1],
};

const valid = validateSkeleton(json);
expect(valid).toBe(true);
});
it("should fail if step solution is invalid", () => {
const step1 = {
...validJson.levels[0].steps[0],
solution: { invalidThing: [] },
};
const level1 = { ...validJson.levels[0], steps: [step1] };
const json = {
...validJson,
levels: [level1],
};

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

[8]ページ先頭

©2009-2025 Movatter.jp