Files
zoolabs.io/lib/research.test.ts
zooqueenandHanzo Dev ae4c4b3034 Give Blue a voice, a wordmark, and links that resolve
Audio: twenty-eight of the twenty-nine clips carry no audio track, so a
mute switch would have switched nothing. What the site can actually say
out loud is the answer, through the browser's own synthesiser — no
network, no key, 180 voices on this machine. The speaker is the user
gesture browsers require, so reading aloud only ever starts because
someone asked for it, and a new question stops the old one mid-sentence.

Proposal links were broken on every card: zips.zoo.ngo serves them under
/docs/<slug>/ and the generator wrote /<slug>, so all 149 pointed at a
404. Fixed, and both link shapes are now asserted — shape is the part a
test can hold, and it is the part that was wrong.

The reply path had no test at all, which is how the parser went unexamined
while the fabricated fallback hid every failure behind it. It has six now,
against a real streaming body: tokens in order, a frame split across two
reads, keep-alives and non-JSON lines skipped, and a refusal arriving as
its own words rather than as prose. Driven end to end against a stand-in
model, the loop lands: clip swaps to Interest, the caption follows, the
[feeling:] tag stays out of the visible answer, and the answer is spoken.

Look: ZOO LABS reads top left at full weight — the mark left the header
for the bottom right, where a launcher belongs, and puts the cursor in the
question box from anywhere on the site. Zen now comes from @hanzo/font,
which is where the family is authored, rather than two woff2 files copied
into public/.

Also fixed: <Paragraph> inside <Paragraph> put a <p> inside a <p> and
broke hydration on both pages; `'' && <X/>` rendered an empty text node
into a gui View, which warns on every render. Both were reported by the
browser and neither had been read.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-01 12:48:58 -07:00

46 lines
1.8 KiB
TypeScript

import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import { test } from 'node:test'
import { search, type Corpus } from './research.ts'
const corpus: Corpus = JSON.parse(readFileSync('public/research.json', 'utf8'))
const everything = [...corpus.papers, ...corpus.zips]
test('the corpus is not empty and nothing in it is nameless', () => {
assert.ok(corpus.papers.length > 50, `only ${corpus.papers.length} papers`)
assert.ok(corpus.zips.length > 100, `only ${corpus.zips.length} proposals`)
for (const work of everything) {
assert.ok(work.title.trim(), `${work.id} has no title`)
assert.ok(work.id.trim(), 'a work has no id')
}
})
// Both link shapes were wrong once: proposals pointed at zips.zoo.ngo/<slug>,
// which 404s — the site serves them under /docs/<slug>/. Shape is what a test
// can hold; that these hosts are reachable is checked by opening them.
test('every proposal links to the page zips.zoo.ngo actually serves', () => {
for (const zip of corpus.zips) {
assert.match(zip.url, /^https:\/\/zips\.zoo\.ngo\/docs\/zip-[\w-]+\/$/, `${zip.id}: ${zip.url}`)
}
})
test('every paper links into the papers repository', () => {
for (const paper of corpus.papers) {
assert.match(paper.url, /^https:\/\/github\.com\/zooai\/papers\/tree\/main\/[\w.-]+$/, paper.url)
}
})
test('no two works share an id', () => {
const ids = everything.map((w) => w.id)
assert.equal(new Set(ids).size, ids.length)
})
test('search needs every term, and prefers titles', () => {
const hits = search(corpus.papers, 'beluga')
assert.ok(hits.length > 0 && hits.length < corpus.papers.length)
assert.match(hits[0].title.toLowerCase(), /beluga/)
assert.deepEqual(search(corpus.papers, 'beluga zzzznotaword'), [])
assert.equal(search(corpus.papers, ' ').length, corpus.papers.length)
})