Script Testing

Coverage Strategy

Script behavior is verified at three levels:

  1. Schema/validator tests for script model and action payload rules.
  2. AnimationManager unit tests for hook execution, bindings, diagnostics, and trigger pulse behavior.
  3. Docs live-demo e2e tests for UI path and API path parity with intermediate runtime state assertions.

Unit-Level Expectations

Validate:

  • Script CRUD and export/import persistence.
  • Hook execution (onRun, onStateChange).
  • Strict script input typing (boolean, number, trigger, string).
  • Binding ID behavior (bindScript / unbindScript).

Live Demo Parity

For /docs/animation/script-live-demo-app.html:

  • UI path and API path both run the same command chain.
  • Machine state must pass an intermediate armed state before final active.
  • Script diagnostics/log panel must show command + hook runtime output.
  • pnpm run lint
  • pnpm exec vitest run packages/animation-manager/tests/AnimationManager.test.ts
  • pnpm exec vitest run packages/schema-validator/tests/schemas/animation.test.ts packages/schema-validator/tests/validators/animation.test.ts
  • pnpm exec playwright test tests/e2e/animation.spec.ts -g "animation script live demo page"