chore(js): polish pong keys, held mapping and m09 main test

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
Lucas Winther
2026-10-29 00:02:23 +01:00
co-authored by Claude Sonnet 5.5
parent 3146bb630a
commit 59bece5443
10 changed files with 209 additions and 16 deletions
+3 -4
View File
@@ -2,10 +2,9 @@ import test from 'node:test'
import assert from 'node:assert/strict'
import { runIO, runApp } from '../src/runtime.js'
import { pure, draw, randomSeed, map, sequence } from '../src/io.js'
import { states, classicActions, render } from '../src/app.js'
import { map as mapStream } from '../src/stream.js'
import { view } from '../src/view.js'
import { newGame, tick } from '../src/spawn.js'
import { classicMain } from './helpers.js'
// A fake platform: records every call and lets the test fire events by hand.
const fakePlatform = (seed = 42) => {
@@ -25,8 +24,8 @@ const fakePlatform = (seed = 42) => {
}
}
// The m09 program: ticks every 150 ms. (The shipped `main` uses speedActions after m10, so these tests build their own.)
const main = map(randomSeed, (seed) => mapStream(states(seed, classicActions), render))
// The m09 program (classicMain) ticks every 150 ms; the shipped `main` uses speedActions after m10.
const main = classicMain
// What the platform should have been asked to draw for a scene.
const expectedCalls = (scene) =>