mirror of
https://github.com/IliesAllali/parenthese.git
synced 2026-11-06 23:32:08 +00:00
Galaxie familiale : personnes, unions et filiations, photos, vidéos et voix sur chaque personne, partage par lien avec consultation sans compte et contributions validées par le propriétaire. Auto-hébergeable avec Docker. Licence PolyForm Noncommercial 1.0.0. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
import test from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import { easeOutCubic, getEntranceProgress, seededFloat, lerp } from '../src/heroGraphMath.js'
|
|
|
|
test('seededFloat is deterministic and bounded', () => {
|
|
const a = seededFloat('p-mother', 3)
|
|
const b = seededFloat('p-mother', 3)
|
|
const c = seededFloat('p-father', 3)
|
|
|
|
assert.equal(a, b)
|
|
assert.notEqual(a, c)
|
|
assert.ok(a >= 0 && a <= 1)
|
|
assert.ok(c >= 0 && c <= 1)
|
|
})
|
|
|
|
test('getEntranceProgress follows expected boundaries', () => {
|
|
assert.equal(getEntranceProgress(0, 100, 500), 0)
|
|
assert.equal(getEntranceProgress(100, 100, 500), 0)
|
|
assert.equal(getEntranceProgress(601, 100, 500), 1)
|
|
assert.equal(getEntranceProgress(250, 100, 500) > 0, true)
|
|
assert.equal(getEntranceProgress(250, 100, 500) < 1, true)
|
|
})
|
|
|
|
test('getEntranceProgress respects reduced motion override', () => {
|
|
assert.equal(getEntranceProgress(0, 9999, 500, true), 1)
|
|
})
|
|
|
|
test('easeOutCubic and lerp basics', () => {
|
|
assert.equal(easeOutCubic(0), 0)
|
|
assert.equal(easeOutCubic(1), 1)
|
|
assert.equal(lerp(0, 10, 0.5), 5)
|
|
})
|