lightspeed/testing/liveview

LiveView-style deterministic testing DSL and debug signatures.

Types

Session

opaque

Stateful test session for mount/update/event fixtures.

pub opaque type Session(model, assigns, msg)

Stateless story fixture output for deterministic template assertions.

pub type StoryFixture {
  StoryFixture(
    name: String,
    html: String,
    fingerprint: String,
    signature: String,
  )
}

Constructors

  • StoryFixture(
      name: String,
      html: String,
      fingerprint: String,
      signature: String,
    )

Values

pub fn failure_signature(
  session: Session(model, assigns, msg),
  assertion: String,
  expected: String,
  actual: String,
) -> String

Stable failure signature helper for assertions and fixture diagnostics.

pub fn has_patch(
  session: Session(model, assigns, msg),
  patch: diff.Patch,
) -> Bool

Assertion helper for expected patch output.

pub fn html(session: Session(model, assigns, msg)) -> String

Current rendered HTML.

pub fn lifecycle(
  session: Session(model, assigns, msg),
) -> stateful.Lifecycle

Mount lifecycle mode.

pub fn lifecycle_label(lifecycle: stateful.Lifecycle) -> String

Stable lifecycle label for fixture signatures.

pub fn mount_connected(
  definition: stateful.LifecycleComponent(model, assigns, msg),
  id: String,
  route: String,
  assigns: assigns,
  target: String,
) -> Session(model, assigns, msg)

Mount a stateful component in connected lifecycle mode.

pub fn mount_disconnected(
  definition: stateful.LifecycleComponent(model, assigns, msg),
  id: String,
  route: String,
  assigns: assigns,
  target: String,
) -> Session(model, assigns, msg)

Mount a stateful component in disconnected lifecycle mode.

pub fn patch_operations(
  session: Session(model, assigns, msg),
) -> List(String)

Patch operation labels in execution order.

pub fn patches(
  session: Session(model, assigns, msg),
) -> List(diff.Patch)

All emitted patches in execution order.

pub fn pushed_event(
  session: Session(model, assigns, msg),
  name: String,
  payload: String,
) -> Bool

Assertion helper for pushed server-event behavior.

pub fn pushed_instructions(
  session: Session(model, assigns, msg),
) -> List(isa.Instruction)

All pushed ISA instructions in execution order.

pub fn redirected_to(
  session: Session(model, assigns, msg),
  to: String,
) -> Bool

Assertion helper for redirect/navigation behavior.

pub fn render_assigns(
  session: Session(model, assigns, msg),
  assigns: assigns,
) -> Session(model, assigns, msg)

Apply parent assigns and capture emitted patches/commands in one test step.

pub fn render_event(
  session: Session(model, assigns, msg),
  name: String,
  payload: String,
) -> #(
  Session(model, assigns, msg),
  Result(msg, event.DecodeError),
)

Route and render one event against the mounted component.

pub fn render_story_fixture(
  fixture_story: story.Story(assigns, slots),
) -> StoryFixture

Render one template story fixture with deterministic metadata.

pub fn stable_signature(
  session: Session(model, assigns, msg),
) -> String

Stable deterministic session signature for CI fixtures and debug output.

pub fn story_fingerprint(fixture: StoryFixture) -> String

Fixture story fingerprint.

pub fn story_html(fixture: StoryFixture) -> String

Fixture story HTML.

pub fn story_name(fixture: StoryFixture) -> String

Fixture story name.

pub fn story_signature(fixture: StoryFixture) -> String

Fixture story stable signature.

pub fn telemetry(
  session: Session(model, assigns, msg),
) -> List(String)

Stable telemetry/debug labels in execution order.

Search Document