Files
cleveragents-core/features/materializers_coverage_r3.feature
freemo 31472b5413 test(coverage): add Behave scenarios for 39 under-covered modules
Add Behave feature/step pairs that exercise uncovered branches across handlers, LSP, CLI, and service layers to reach the coverage gate.

ISSUES CLOSED: #1232
2026-03-31 21:47:12 +00:00

88 lines
4.5 KiB
Gherkin

Feature: Materializers coverage round 3
As a developer maintaining the output rendering framework
I want thorough test coverage on materializer strategies
So that edge-case code paths in live and accumulate strategies are verified
# ---------------------------------------------------------------
# Line 344: _BaseBufferStrategy.on_element_closed early return
# when event.final_state is None
# ---------------------------------------------------------------
Scenario: Buffer strategy ignores element closed with no final state
Given matcov3 a PlainMaterializer instance
And matcov3 the strategy has a registered handle "hdl-abc" at index 0
When matcov3 an ElementClosed event with handle "hdl-abc" and no final state is dispatched
Then matcov3 the plain strategy output is empty
# ---------------------------------------------------------------
# Line 473: _LiveMaterializationStrategy._render_element base class
# ---------------------------------------------------------------
Scenario: Live strategy base class render_element delegates to color renderer
Given matcov3 a raw LiveMaterializationStrategy instance
And matcov3 a StatusMessage element with message "live-base-test"
When matcov3 I call the live base class _render_element
Then matcov3 the rendered text contains "live-base-test"
# ---------------------------------------------------------------
# Lines 486-487: _LiveMaterializationStrategy.on_element_created
# with initial_state=None
# ---------------------------------------------------------------
Scenario: Live strategy handles element created with no initial state
Given matcov3 a raw LiveMaterializationStrategy instance
When matcov3 an ElementCreated event with no initial state is dispatched to the live strategy
Then matcov3 the live strategy has an empty rendered entry at the declaration index
And matcov3 the live strategy has height zero at the declaration index
# ---------------------------------------------------------------
# Line 495: _LiveMaterializationStrategy.on_element_updated
# with unknown handle_id (idx is None)
# ---------------------------------------------------------------
Scenario: Live strategy ignores update for unknown handle
Given matcov3 a raw LiveMaterializationStrategy instance
When matcov3 an ElementUpdated event for unknown handle "hdl-ghost" is dispatched to the live strategy
Then matcov3 the live strategy rendered dict is empty
# ---------------------------------------------------------------
# Line 497: _LiveMaterializationStrategy.on_element_updated
# for a frozen (closed) element
# ---------------------------------------------------------------
Scenario: Live strategy ignores update for a frozen element
Given matcov3 a raw LiveMaterializationStrategy instance
And matcov3 a live element "hdl-frozen" is created and then closed at index 5
When matcov3 an ElementUpdated event for handle "hdl-frozen" is dispatched to the live strategy
Then matcov3 no error is raised for the frozen update
# ---------------------------------------------------------------
# Line 509: _LiveMaterializationStrategy.on_element_closed
# with unknown handle_id
# ---------------------------------------------------------------
Scenario: Live strategy ignores close for unknown handle
Given matcov3 a raw LiveMaterializationStrategy instance
When matcov3 an ElementClosed event for unknown handle "hdl-unknown-live" is dispatched to the live strategy
Then matcov3 the live strategy closed indices set is empty
# ---------------------------------------------------------------
# Line 550: _LiveMaterializationStrategy._render_frame with
# empty dirty set
# ---------------------------------------------------------------
Scenario: Live strategy render frame returns early when dirty set is empty
Given matcov3 a raw LiveMaterializationStrategy instance
When matcov3 I call _render_frame on the live strategy with an empty dirty set
Then matcov3 the live strategy stream is still empty
# ---------------------------------------------------------------
# Line 610: _AccumulateStrategy.on_element_updated returns
# immediately
# ---------------------------------------------------------------
Scenario: Accumulate strategy on_element_updated returns immediately
Given matcov3 a JsonMaterializer instance
When matcov3 an ElementUpdated event is dispatched to the accumulate strategy
Then matcov3 no error is raised for the accumulate update