chore: keep the fixture generator scripts and the replay-sample bot
scripts/fixtures/ holds the scripts that produced the 2026-11-11 fixtures, with a README on running them safely into a copy. Run in order they reproduce the content of every fixture they touch. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
1e3cea5eac
commit
5062838604
17 files changed
+432
-3
No files matched your search
@@ -0,0 +1,42 @@
|
||||
import { writeFileSync } from 'node:fs'
|
||||
import { viewerUpdate, viewerKey, viewerView, frames, ViewerAction as A } from '../../js/solutions/replay.js'
|
||||
// Fixture regeneration aid (see scripts/fixtures/README.md). Written during the 2026-11-11 build, kept for reference.
|
||||
// Writes into fixtures/ unless FIXTURES_OUT names another directory (with a trailing slash).
|
||||
const FIX = process.env.FIXTURES_OUT ?? new URL('../../fixtures/', import.meta.url).pathname
|
||||
const SOL = new URL('../../js/solutions/', import.meta.url).href
|
||||
const HERE = new URL('./', import.meta.url).pathname
|
||||
const F = FIX
|
||||
const fmt = (fn, cases) => '{\n "function": "' + fn + '",\n "cases": [\n' + cases.map((c) => ' ' + JSON.stringify(c)).join(',\n') + '\n ]\n}\n'
|
||||
const v = (index, last, playing) => ({ index, last, playing })
|
||||
const u = [
|
||||
['next-moves-one-frame-forward', v(3, 10, false), A.Next],
|
||||
['next-at-the-last-frame-stays', v(10, 10, false), A.Next],
|
||||
['prev-moves-one-frame-back', v(3, 10, false), A.Prev],
|
||||
['prev-at-the-first-frame-stays', v(0, 10, false), A.Prev],
|
||||
['first-goes-to-frame-zero', v(7, 10, false), A.First],
|
||||
['last-goes-to-the-last-frame', v(2, 10, false), A.Last],
|
||||
['toggle-play-starts-autoplay', v(4, 10, false), A.TogglePlay],
|
||||
['toggle-play-stops-autoplay', v(4, 10, true), A.TogglePlay],
|
||||
['toggle-play-at-the-end-starts-again-from-the-first-frame', v(10, 10, false), A.TogglePlay],
|
||||
['beat-while-playing-moves-one-frame-forward', v(4, 10, true), A.Beat],
|
||||
['beat-while-not-playing-is-ignored', v(4, 10, false), A.Beat],
|
||||
['beat-that-reaches-the-last-frame-stops-autoplay', v(9, 10, true), A.Beat],
|
||||
['next-while-playing-keeps-playing', v(4, 10, true), A.Next],
|
||||
['prev-while-playing-keeps-playing', v(4, 10, true), A.Prev],
|
||||
['last-while-playing-stops-autoplay', v(4, 10, true), A.Last],
|
||||
['first-while-playing-keeps-playing', v(4, 10, true), A.First],
|
||||
['a-recording-with-no-actions-cannot-play', v(0, 0, false), A.TogglePlay],
|
||||
['a-recording-with-no-actions-stays-at-frame-zero', v(0, 0, false), A.Next],
|
||||
]
|
||||
writeFileSync(F + 'm10-viewer-update.json', fmt('viewerUpdate', u.map(([name, s, a]) => ({ name, args: [s, a], expected: viewerUpdate(s, a) }))))
|
||||
const keys = [['ArrowRight-is-next','ArrowRight'],['d-is-next','d'],['D-is-next','D'],['ArrowLeft-is-prev','ArrowLeft'],['a-is-prev','a'],['A-is-prev','A'],
|
||||
['Home-is-first','Home'],['End-is-last','End'],['space-toggles-play',' '],['ArrowUp-is-not-bound','ArrowUp'],['r-is-not-bound','r'],
|
||||
['constructor-is-not-bound','constructor'],['toString-is-not-bound','toString'],['empty-string-is-not-bound','']]
|
||||
writeFileSync(F + 'm10-viewer-key.json', fmt('viewerKey', keys.map(([name, k]) => ({ name, args: [k], expected: viewerKey(k) }))))
|
||||
const fs = frames({ seed: 42, actions: [{ tag: 'Tick' }, { tag: 'Turn', dir: 'Up' }] })
|
||||
const vw = [
|
||||
['first-frame-not-playing', v(0, 2, false)],
|
||||
['middle-frame-while-playing', v(1, 2, true)],
|
||||
['last-frame', v(2, 2, false)],
|
||||
]
|
||||
writeFileSync(F + 'm10-viewer-view.json', fmt('viewerView', vw.map(([name, s]) => ({ name, args: [fs, s], expected: viewerView(fs, s) }))))
|
||||
Reference in new issue
Block a user