33 lines
1.5 KiB
TypeScript
33 lines
1.5 KiB
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import { existsSync } from "node:fs";
|
|
import { resolve } from "node:path";
|
|
import { createCourseRepository, extractHints } from "../src/index";
|
|
|
|
const overlays = resolve(import.meta.dir, "../../../overlays");
|
|
const snakeRoot = "/home/user/functional-programming-course";
|
|
const systemicRoot = "/home/user/systemic-design-course";
|
|
|
|
describe("reference courses", () => {
|
|
test.skipIf(!existsSync(snakeRoot))("pure-snake loads cleanly", async () => {
|
|
const repo = await createCourseRepository([overlays]);
|
|
const c = repo.get("pure-snake")!;
|
|
expect(c.diagnostics.filter((d) => d.level === "error")).toEqual([]);
|
|
expect(c.status).toBe("ok");
|
|
expect(c.manifest!.modules).toHaveLength(13);
|
|
expect(c.lessonIndex.has("m03-ex-move")).toBe(true);
|
|
const hints = c.lessonIndex.get("m03-ex-move")!.lesson.hints!;
|
|
const md = await Bun.file(repo.resolvePath("pure-snake", hints.file)!).text();
|
|
expect(extractHints(md, hints.match)).toHaveLength(3);
|
|
expect(await repo.readLessonMarkdown("pure-snake", "m03-ex-move")).toStartWith("### Exercise 3.1");
|
|
});
|
|
|
|
test.skipIf(!existsSync(systemicRoot))("systemic-design loads cleanly", async () => {
|
|
const repo = await createCourseRepository([overlays]);
|
|
const c = repo.get("systemic-design")!;
|
|
expect(c.diagnostics.filter((d) => d.level === "error")).toEqual([]);
|
|
expect(c.status).toBe("ok");
|
|
expect(c.manifest!.modules).toHaveLength(11);
|
|
expect(c.manifest!.gating).toBe("sequential");
|
|
});
|
|
});
|