test: sample fixture course

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Lucas Winther
2026-10-30 02:50:00 +01:00
co-authored by Claude Opus 5.5
parent 7e7ce30535
commit 7a68800f6f
13 changed files with 97 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
You are the mentor for the sample course. Give hints, never full solutions.
@@ -0,0 +1 @@
echo "hello from the sample course"
@@ -0,0 +1,3 @@
export function add(a, b) {
return a + b;
}
@@ -0,0 +1,3 @@
export function add(a, b) {
return a - b;
}
@@ -0,0 +1,4 @@
export const tests = [
{ name: "adds 2 and 3", run: (mod, assert) => assert.equal(mod.add(2, 3), 5) },
{ name: "adds -1 and 1", run: (mod, assert) => assert.equal(mod.add(-1, 1), 0) },
];
@@ -0,0 +1,3 @@
# Introduction
Welcome to the sample course. It exists so tests have something small to load.
@@ -0,0 +1,3 @@
# Transcript
A two-second test pattern plays. Nothing is said.
@@ -0,0 +1,7 @@
# Code along
Run the script in the section files:
```sh
sh hello.sh
```
@@ -0,0 +1,23 @@
# Adding numbers
Functions take values and return values.
## Exercises
### Exercise 2.1 — `add`
Implement `add(a, b)` so that it returns the sum of its arguments.
## Hints
<details><summary>Exercise 2.1 (add) — nudge</summary>
Which operator combines two numbers?
</details>
<details><summary>Exercise 2.1 (add) — near-solution</summary>
Return `a + b`.
</details>
Binary file not shown.
Binary file not shown.
+35
View File
@@ -0,0 +1,35 @@
schema: 1
id: sample
title: Sample course
pitch: A tiny self-contained course used by the test suite.
visibility: public
tracks:
- { id: js, label: JavaScript }
mentor: MENTOR.md
source: { kind: authored }
decks:
- { id: d1, file: media/deck.pdf, attachTo: m1-video }
modules:
- id: m1
title: First steps
code: { dir: "code/S01 - First steps", command: "sh hello.sh" }
lessons:
- { id: m1-intro, title: Introduction, type: text, file: lessons/01-intro.md }
- { id: m1-video, title: Watch the clip, type: video, file: media/clip.mp4, duration: 2, transcript: lessons/02-video.md }
- { id: m1-code, title: Code along, type: text, file: lessons/03-code.md }
- id: m2
title: Exercises
lessons:
- { id: m2-text, title: Adding numbers, type: text, file: lessons/04-exercise.md }
- id: m2-ex-add
title: "Exercise 2.1: add"
type: exercise
file: lessons/04-exercise.md
anchor: exercise-21--add
hints: { file: lessons/04-exercise.md, match: "Exercise 2.1 (add)" }
browser:
language: js
starter: exercises/add/starter.js
tests: exercises/add/tests.js
solution: exercises/add/solution.js
localCommand: "node --test"
+14
View File
@@ -0,0 +1,14 @@
#!/bin/sh
# Regenerates the binary fixtures under fixtures/courses/sample/media.
set -eu
cd "$(dirname "$0")/../fixtures/courses/sample/media"
/usr/bin/ffmpeg -y -loglevel error -f lavfi -i "testsrc=duration=2:size=160x90:rate=10" \
-pix_fmt yuv420p -c:v libx264 -crf 35 -preset veryslow -movflags +faststart clip.mp4
/home/user/.venvs/pdf/bin/python -I - <<'PY'
import pymupdf
doc = pymupdf.open()
for i, text in enumerate(["Sample deck: title", "Sample deck: middle", "Sample deck: end"], 1):
page = doc.new_page(width=480, height=270)
page.insert_text((40, 135), text, fontsize=24)
doc.save("deck.pdf", garbage=4, deflate=True)
PY