Skip to content
main
Make the player visible with a procedural 3D humanoid132be7c
JavaScript23 lines1.0 KB
import test from 'node:test';import assert from 'node:assert/strict';import { targetPose, POSES, POSE_KEYS } from './pose.mjs'; const specs = { punch: { startup: 0.1, active: 0.1, recovery: 0.2 } };const f = (t) => ({ stance: 'punch', facing: 1, attack: { t } }); test('anticipation dips crouch mid-startup beyond the wind pose blend', () => {  assert.ok(targetPose(f(0.05), 0, specs).crouch > (POSES.idle.crouch + POSES.punchWind.crouch) / 2);});test('follow-through overshoots lean during recovery', () => {  const p = targetPose(f(0.3), 0, specs);  assert.ok(p.lean > (POSES.punchHit.lean + POSES.idle.lean) / 2);});test('idle weight shift varies over time', () => {  assert.notEqual(targetPose({ stance: 'idle' }, 0.5).lean, targetPose({ stance: 'idle' }, 2).lean);});test('hit reaction recoil decays', () => {  const a = targetPose({ stance: 'hit', hitT: 0 }), b = targetPose({ stance: 'hit', hitT: 1 });  assert.ok(Math.abs(a.torso) > Math.abs(b.torso));  for (const k of POSE_KEYS) assert.ok(Number.isFinite(a[k]));});