Testing

The fixture and the walkthrough a test drives a definition through the whole environment contract with, through public surfaces only. The headless host it mounts on is under Host.

@internote/canvas-sdk/testing8 exports

Also exported here, documented under @internote/canvas-sdk/host: createHeadlessCanvasHost, HeadlessCanvasHost, HeadlessEnvironment, HeadlessHostOptions, HeadlessScene.

#Functions

initialLabelState
packages/canvas-sdk/src/testing/label-environment.ts:25
A fresh label state: no bumps, no captions shown, no steps seen.
(): LabelState
runLabelWalkthrough
packages/canvas-sdk/src/testing/walkthrough.ts:44
Mounts the label fixture on a headless host and checks the environment contract end to end.
(): WalkthroughReport

Covers the semantic pass, layout, cues firing, !cue.to keyframes, toolbar items resolving, and state surviving scroll-away and continue: — using only public SDK surfaces, on a manual clock. Headless and framework-free: run it from any test runner or script and assert report.failed is empty.

#Constants

LABEL_SOURCE
packages/canvas-sdk/src/testing/label-fixture.ts:13
The chalk source of the label walkthrough: two scenes, a canvas.label with a cued caption and !cue.to keyframes, and a second scene that continues it.
string
labelDocument
packages/canvas-sdk/src/testing/label-fixture.ts:25
LABEL_SOURCE, compiled and refined: the document the label walkthrough mounts.

Captured from the real pipeline: compiled by the @internote/chalk wasm compiler against buildInternoteLibrary() with the label type registered, then run through refineInternoteDocument (which turned the !cue.to chains into keyframe tracks and the anchors into wire shapes). Regenerate it by recompiling the source whenever the language changes shape.

labelEnvironment
packages/canvas-sdk/src/testing/label-environment.ts:47
A toy canvas.label environment that exercises the whole environment contract through public SDK surfaces only.
EnvironmentDefinition

It is the reference for how an environment is authored end to end:

  • vocabulary validated by the compiler (caption, with cue anchors);
  • !cue.to keyframes on emphasis (number) and window (interval);
  • a verb handler and step hook driving session state;
  • a declarative toolbar contribution;
  • session-tier storage that survives scroll-away and continue:.

Deliberately trivial on the render side (its surface draws nothing) — the point is the contract, not the pixels. Exported from @internote/canvas-sdk/testing; not registered anywhere by default.

#Interfaces

LabelState
packages/canvas-sdk/src/testing/label-environment.ts:15
The session state of the toy labelEnvironment: counters the walkthrough asserts on.
bumpsRequired
How many times the reader pressed the toolbar bump.
number
captionsShownRequired
Captions currently shown, by verb dispatch.
number
stepsSeenRequired
Steps the type has seen via onStep.
number[]
WalkthroughCheck
packages/canvas-sdk/src/testing/walkthrough.ts:18
One assertion of the label walkthrough.
detail
What was found instead, on a failed check.
string
nameRequired
What was checked, as a sentence.
string
passedRequired
Whether it held.
boolean
WalkthroughReport
packages/canvas-sdk/src/testing/walkthrough.ts:28
The label walkthrough's results, split by outcome.
failedRequired
The checks that did not; empty when the SDK meets its contract.
WalkthroughCheck[]
passedRequired
The checks that held.
WalkthroughCheck[]

Last updated