oficina / slides Public

Clone
git clone https://amadan.net/oficina/slides

Plain git — no account needed to clone.

Download

Download this file

1// presses.test.mjs — the browser's presses against the server's, through
2// the shared vectors (vectors/presses.json, which
3// internal/slides/deck/presses_test.go reads too).
4import { test } from 'node:test'
5import assert from 'node:assert/strict'
6import { readFileSync } from 'node:fs'
7import { presses } from './presses.mjs'
8
9const vectors = JSON.parse(readFileSync(new URL('./vectors/presses.json', import.meta.url)))
10
11test('presses vectors', async t => {
12 assert.ok(vectors.length >= 10)
13 for (const c of vectors) {
14 await t.test(c.name, () => {
15 assert.deepEqual(presses(c.slide, c.scenes), c.presses)
16 })
17 }
18})
19
20test('a slide with no blocks key has no presses', () => {
21 assert.deepEqual(presses({ id: 's' }), [])
22})
23