feat: publish CodexPi contest snapshot
Some checks are pending
Qualité / tests (push) Waiting to run

This commit is contained in:
CodexPi
2026-11-14 20:23:59 +01:00
commit 995b17a6e2
295 changed files with 36803 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
import assert from 'node:assert/strict'
import test from 'node:test'
import { speechTextFromMarkdown, splitSpeechText } from '../src/speech.ts'
test('markdown is converted to natural speech without fenced code or URLs', () => {
const markdown = `# Résultat
Voici **la réponse** avec [la documentation](https://example.com/docs) et \`npm test\`.
\`\`\`ts
const secret = 'not read aloud'
\`\`\`
- Premier point
- Deuxième point`
const spoken = speechTextFromMarkdown(markdown)
assert.match(spoken, /Résultat/)
assert.match(spoken, /la réponse/)
assert.match(spoken, /la documentation/)
assert.match(spoken, /npm test/)
assert.match(spoken, /Bloc de code omis/)
assert.doesNotMatch(spoken, /https|secret|\*\*|```/)
})
test('long speech is split into short non-empty chunks without losing text', () => {
const text = `${'Une phrase assez longue. '.repeat(18)}Dernière phrase.`
const chunks = splitSpeechText(text, 180)
assert.ok(chunks.length > 1)
assert.ok(chunks.every(chunk => chunk.length > 0 && chunk.length <= 180))
assert.equal(chunks.join(' '), text.replace(/\s+/g, ' ').trim())
})