- Add Profile enum (ISABELLA, FRANCESCA, SEBASTIAN) to Child model - Add ?profile= query param override to /api/curriculum/next - Pass profile prop from profile-specific pages to ExerciseSession - Fix curriculum import paths (engine uses @/curriculum/ alias) - Clear stale curriculumCache on dev reload - Fix self-referential prerequisites in Francesca etapa-1 - Fix prerequisite chains in Francesca etapa-2,3,4 and Sebastian etapa-2,3 - Add Francesca curriculum: 2-3 digit sums, subtractions, multiplications, short readings - Add Sebastian curriculum: 2-3 digit sums, interactive exercises, Argentine history, flags - All 44 E2E tests pass, TypeScript compiles cleanly
142 lines
5.0 KiB
TypeScript
142 lines
5.0 KiB
TypeScript
import { test, expect } from "@playwright/test"
|
|
import { readFileSync } from "fs"
|
|
import { join } from "path"
|
|
|
|
const lecturaStages = 9
|
|
const numerosStages = 8
|
|
|
|
test.describe("Exercise content integrity", () => {
|
|
for (let i = 1; i <= lecturaStages; i++) {
|
|
test(`lectura etapa ${i} file exists and has exercises`, () => {
|
|
const file = join(process.cwd(), "curriculum", "lectura", `etapa-${i}.ts`)
|
|
const content = readFileSync(file, "utf-8")
|
|
expect(content.length).toBeGreaterThan(200)
|
|
expect(content).toContain("stage")
|
|
expect(content).toContain("exercises")
|
|
})
|
|
}
|
|
|
|
for (let i = 1; i <= numerosStages; i++) {
|
|
test(`numeros etapa ${i} file exists and has exercises`, () => {
|
|
const file = join(process.cwd(), "curriculum", "numeros", `etapa-${i}.ts`)
|
|
const content = readFileSync(file, "utf-8")
|
|
expect(content.length).toBeGreaterThan(200)
|
|
expect(content).toContain("stage")
|
|
expect(content).toContain("exercises")
|
|
})
|
|
}
|
|
|
|
test("curriculum index loads Isabella stages [1..9]", () => {
|
|
const file = join(process.cwd(), "curriculum", "index.ts")
|
|
const content = readFileSync(file, "utf-8")
|
|
expect(content).toContain("[1, 2, 3, 4, 5, 6, 7, 8, 9]")
|
|
})
|
|
|
|
test("type definitions export required types", () => {
|
|
const file = join(process.cwd(), "curriculum", "types.ts")
|
|
const content = readFileSync(file, "utf-8")
|
|
expect(content).toContain("export type Exercise")
|
|
expect(content).toContain("export interface Stage")
|
|
expect(content).toContain("export type ExerciseType")
|
|
expect(content).toContain("export type ErrorType")
|
|
})
|
|
|
|
test("exercise dispatcher maps all exercise types", () => {
|
|
const file = join(process.cwd(), "components", "exercises", "exercise-dispatcher.tsx")
|
|
const content = readFileSync(file, "utf-8")
|
|
const types = ["sensibilizacion", "conciencia", "trazo", "eleccion", "emparejar", "secuencia", "palabra", "problema", "lectura"]
|
|
for (const t of types) {
|
|
expect(content).toContain(t)
|
|
}
|
|
})
|
|
|
|
test("all exercise component files exist", () => {
|
|
const components = [
|
|
"ejercicio-sensibilizacion",
|
|
"ejercicio-conciencia",
|
|
"ejercicio-eleccion",
|
|
"ejercicio-secuencia",
|
|
"ejercicio-palabra",
|
|
"ejercicio-lectura",
|
|
"ejercicio-trazo",
|
|
"exercise-dispatcher",
|
|
]
|
|
for (const c of components) {
|
|
const file = join(process.cwd(), "components", "exercises", `${c}.tsx`)
|
|
const content = readFileSync(file, "utf-8")
|
|
expect(content.length).toBeGreaterThan(100)
|
|
}
|
|
})
|
|
|
|
test("Francesca matemáticas etapa 1..4 exist", () => {
|
|
for (let i = 1; i <= 4; i++) {
|
|
const file = join(process.cwd(), "curriculum", "francesca", `etapa-${i}.ts`)
|
|
const content = readFileSync(file, "utf-8")
|
|
expect(content.length).toBeGreaterThan(100)
|
|
expect(content).toContain("stage")
|
|
expect(content).toContain("exercises")
|
|
}
|
|
})
|
|
|
|
test("Francesca lecturas etapa 1..2 exist", () => {
|
|
for (let i = 1; i <= 2; i++) {
|
|
const file = join(process.cwd(), "curriculum", "francesca-lectura", `etapa-${i}.ts`)
|
|
const content = readFileSync(file, "utf-8")
|
|
expect(content.length).toBeGreaterThan(100)
|
|
}
|
|
})
|
|
|
|
test("Sebastián sumas etapa 1..3 exist", () => {
|
|
for (let i = 1; i <= 3; i++) {
|
|
const file = join(process.cwd(), "curriculum", "sebastian", `etapa-${i}.ts`)
|
|
const content = readFileSync(file, "utf-8")
|
|
expect(content.length).toBeGreaterThan(100)
|
|
}
|
|
})
|
|
|
|
test("Sebastián historia etapa 1..2 exist", () => {
|
|
for (let i = 1; i <= 2; i++) {
|
|
const file = join(process.cwd(), "curriculum", "sebastian-historia", `etapa-${i}.ts`)
|
|
const content = readFileSync(file, "utf-8")
|
|
expect(content.length).toBeGreaterThan(100)
|
|
}
|
|
})
|
|
|
|
test("Sebastián banderas etapa 1 exist", () => {
|
|
const file = join(process.cwd(), "curriculum", "sebastian-banderas", "etapa-1.ts")
|
|
const content = readFileSync(file, "utf-8")
|
|
expect(content.length).toBeGreaterThan(100)
|
|
})
|
|
|
|
test("exercise-session component exists", () => {
|
|
const file = join(process.cwd(), "components", "child", "exercise-session.tsx")
|
|
const content = readFileSync(file, "utf-8")
|
|
expect(content.length).toBeGreaterThan(200)
|
|
})
|
|
|
|
test("multi-profile pages exist", () => {
|
|
const pages = [
|
|
"app/francesca/page.tsx",
|
|
"app/francesca/matematicas/page.tsx",
|
|
"app/francesca/lecturas/page.tsx",
|
|
"app/sebastian/page.tsx",
|
|
"app/sebastian/sumas/page.tsx",
|
|
"app/sebastian/historia/page.tsx",
|
|
"app/sebastian/banderas/page.tsx",
|
|
]
|
|
for (const p of pages) {
|
|
const file = join(process.cwd(), p)
|
|
const content = readFileSync(file, "utf-8")
|
|
expect(content.length).toBeGreaterThan(50)
|
|
}
|
|
})
|
|
|
|
test("root page is profile selector with 3 names", () => {
|
|
const file = join(process.cwd(), "app", "page.tsx")
|
|
const content = readFileSync(file, "utf-8")
|
|
expect(content).toContain("Isabella")
|
|
expect(content).toContain("Francesca")
|
|
expect(content).toContain("Sebastián")
|
|
})
|
|
})
|