brain backup 2026-09-14

This commit is contained in:
Adolfo Reyna
2026-09-14 22:38:47 -04:00
parent ca346cc6e7
commit f0ead4f6fa
147 changed files with 73451 additions and 8 deletions
@@ -0,0 +1,23 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { filterUnits, subjectsFor, teacherGuidesFor } from '../src/library.mjs';
const units = [
{ subject: 'Math', title: 'Grade 3 Math', materials: [{ role: 'Teacher Guide', id: 'math-guide' }] },
{ subject: 'Science', title: 'Grade 3 Science', materials: [{ role: 'Student Reader', id: 'science-reader' }] },
{ subject: 'Math', title: 'Math Literature', materials: [] },
];
test('lists available subjects with All first', () => {
assert.deepEqual(subjectsFor(units), ['All', 'Math', 'Science']);
});
test('filters units by selected subject', () => {
assert.deepEqual(filterUnits(units, 'Math').map((unit) => unit.title), ['Grade 3 Math', 'Math Literature']);
assert.equal(filterUnits(units, 'All').length, 3);
});
test('selects only a unit’s teacher-plan PDFs', () => {
assert.deepEqual(teacherGuidesFor(units[0]), [{ role: 'Teacher Guide', id: 'math-guide' }]);
assert.deepEqual(teacherGuidesFor(units[1]), []);
});