- Eliminada ruta duplicada /sebastian/sumas (código muerto) - Removido topic 'sumas' del engine (reemplazado por 'matematicas') - Creado docker-compose.yml (PostgreSQL + app, 1 comando install) - Dockerfile: copiado prisma CLI al runner stage para db push - APIs debug protegidas: 403 en producción (reset, state, seed) - Audit métodos europeos: 24 archivos corregidos al 100% - Montessori: matemática Francesca + Sebastián - Decroly: lectura, ortografía, historia, geografía, banderas - Borel-Maisonny: lectura inicial Isabella (ya existía) - Freinet: expresión escrita Sebastián (ya existía) - Validación prerequisitos: 0 rotos en contenido nuevo (157 ejercicios) - INSTALL.md: guía completa de instalación - fase4.md: documentación del overhaul - E2E: 2 tests corregidos, 61/61 pasan - TypeScript: exit 0, Build: exit 0
171 lines
6.1 KiB
TypeScript
171 lines
6.1 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..10 exist", () => {
|
|
for (let i = 1; i <= 10; 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..9 exist", () => {
|
|
for (let i = 1; i <= 9; i++) {
|
|
const file = join(process.cwd(), "curriculum", "francesca-lectura", `etapa-${i}.ts`)
|
|
const content = readFileSync(file, "utf-8")
|
|
expect(content.length).toBeGreaterThan(100)
|
|
}
|
|
})
|
|
|
|
test("Francesca ortografía etapa 1..2 exist", () => {
|
|
for (let i = 1; i <= 2; i++) {
|
|
const file = join(process.cwd(), "curriculum", "francesca-ortografia", `etapa-${i}.ts`)
|
|
const content = readFileSync(file, "utf-8")
|
|
expect(content.length).toBeGreaterThan(100)
|
|
}
|
|
})
|
|
|
|
test("Sebastián matemáticas etapa 1..11 exist", () => {
|
|
for (let i = 1; i <= 11; 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..5 exist", () => {
|
|
for (let i = 1; i <= 5; 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..2 exist", () => {
|
|
for (let i = 1; i <= 2; i++) {
|
|
const file = join(process.cwd(), "curriculum", "sebastian-banderas", `etapa-${i}.ts`)
|
|
const content = readFileSync(file, "utf-8")
|
|
expect(content.length).toBeGreaterThan(100)
|
|
}
|
|
})
|
|
|
|
test("Sebastián lectura etapa 1..6 exist", () => {
|
|
for (let i = 1; i <= 6; i++) {
|
|
const file = join(process.cwd(), "curriculum", "sebastian-lectura", `etapa-${i}.ts`)
|
|
const content = readFileSync(file, "utf-8")
|
|
expect(content.length).toBeGreaterThan(100)
|
|
}
|
|
})
|
|
|
|
test("Sebastián geografía etapa 1..3 exist", () => {
|
|
for (let i = 1; i <= 3; i++) {
|
|
const file = join(process.cwd(), "curriculum", "sebastian-geografia", `etapa-${i}.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/francesca/ortografia/page.tsx",
|
|
"app/sebastian/page.tsx",
|
|
"app/sebastian/matematicas/page.tsx",
|
|
"app/sebastian/historia/page.tsx",
|
|
"app/sebastian/banderas/page.tsx",
|
|
"app/sebastian/lectura/page.tsx",
|
|
"app/sebastian/geografia/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")
|
|
})
|
|
})
|