17 lines
895 B
TypeScript
17 lines
895 B
TypeScript
import assert from "node:assert/strict";
|
|
import { test } from "node:test";
|
|
import { chapters, seriesCover } from "../src/content/learning-skills/data";
|
|
|
|
test("the authored series has three distinct chapters of ten sourced skills and one cover",()=>{
|
|
assert.equal(chapters.length,3);assert.equal(new Set(chapters.map(c=>c.key)).size,3);
|
|
assert.equal(new Set(chapters.map(c=>c.slug)).size,3);assert.equal(seriesCover,"/learning-skills/cover.png");
|
|
for(const chapter of chapters){
|
|
assert.equal(chapter.skills.length,10);assert.equal(new Set(chapter.skills.map(s=>s.source)).size,10);
|
|
for(const skill of chapter.skills){
|
|
const source=new URL(skill.source);assert.equal(source.protocol,"https:");assert.equal(source.hostname,"github.com");
|
|
assert.ok(skill.title&&skill.input&&skill.output&&skill.prompt&&skill.note);
|
|
assert.equal(skill.sample.length,3);
|
|
}
|
|
}
|
|
});
|