import assert from 'node:assert/strict'; import { describe, it } from 'node:test'; import { parseHomeworkPage } from '../src/core/homework-page.ts'; /** * Fixtures mirror the legacy client's templates (feedback.hbs, submission.hbs) * as actually served — including the parts that are absent for a student, which * is what makes every field optional. */ const page = (parts: { submission?: string; feedback?: string; afterSubmission?: string }) => `
Du hast 85% erreicht
' }); assert.equal(parseHomeworkPage(html)?.gradePercent, 85); }); it('reads the student\'s typed answer from the editable textarea', () => { const html = page({ submission: ``, }); assert.equal(parseHomeworkPage(html)?.submittedText, 'Meine Lösung'); }); it('reads the typed answer from the read-only form once submission closed', () => { // The read-only `Abgegebener Text
Meine Abgabe
Gut gemacht
vollständig und nachvollziehbar