Caravela.Gen.LiveViewTest (Caravela v0.13.3)

Copy Markdown View Source

Generates ExUnit tests for every :live entity's three LiveView modules (Index / Show / Form). One test file per entity, organized as describe blocks per module with one test per action — a CI-ready skeleton the developer fills in with fixtures and assertions specific to their domain.

The generated tests use the standard Phoenix test stack (Phoenix.ConnTest, Phoenix.LiveViewTest) and assume the consumer app has a *.ConnCase module under test/support/conn_case.ex — which mix phx.new emits by default, so no extra setup is needed.

Each generated test carries a # TODO: line pointing at the fixture hole to fill — the generator cannot know the app's context factories, so it stops short of full assertions.

Returns a list of {path, source} tuples. Custom code below the # --- CUSTOM --- marker is preserved on regeneration.

Summary

Functions

Generate a test file per :live entity in the domain.

Generate a single entity's LiveView test file.

Path to the generated test file, relative to the project root.

Functions

render_all(domain, opts \\ [])

@spec render_all(
  Caravela.Schema.Domain.t(),
  keyword()
) :: [{String.t(), String.t()}]

Generate a test file per :live entity in the domain.

render_entity(domain, entity, opts \\ [])

Generate a single entity's LiveView test file.

test_file_path(domain, entity)

Path to the generated test file, relative to the project root.