SPB Git

Repository Public

paths.test.ts 1.1 KB 21 lines typescript

1import { describe, expect, it } from "vitest";2import { LEARNING_PATHS, pathProblems } from "@/lib/paths";3import { loadManifest } from "./helpers";45describe("suggested learning paths", () => {6  const sessions = loadManifest().sessions;7  it("cover the four audiences of the specification", () => {8    expect(LEARNING_PATHS.map((p) => p.audience)).toEqual(["Débutant", "Professionnel", "Développeur", "Chercheur"]);9  });10  it("respect the course plan: every prerequisite is included and comes first", () => {11    for (const p of LEARNING_PATHS) expect(pathProblems(p, sessions), p.id).toEqual([]);12  });13  it("the beginner path contains beginner sessions only", () => {14    const beginner = LEARNING_PATHS[0]!;15    for (const id of beginner.sessions) expect(sessions.find((s) => s.id === id)!.level, id).toBe("débutant");16  });17  it("detects a broken path", () => {18    expect(pathProblems({ id: "x", audience: "", title: "", description: "", sessions: ["S02", "S01", "S99"] }, sessions)).toEqual(["S02 vient avant son préalable S01, ou S01 manque", "S99 n'existe pas dans le plan de cours"]);19  });20});21
Files main
Menu

Theme