feat: add key-free demo mode replaying recorded fixtures
This commit is contained in:
parent
0664cc2d27
commit
401a0ddea7
21 changed files with 1040 additions and 31 deletions
32
backend/tests/test_demo_scenario.py
Normal file
32
backend/tests/test_demo_scenario.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
"""Tests for deterministic demo scenario selection."""
|
||||
|
||||
from app.adapters.demo.scenario import select_replay_scenario, select_scenario
|
||||
|
||||
|
||||
def test_scenario_selection_prefers_normalized_exact_query_or_chip() -> None:
|
||||
query_match = select_scenario("something calm for while I am programming, but not boring")
|
||||
chip_match = select_scenario(" FOCUS, while CODING! ")
|
||||
|
||||
assert query_match.key == "focus-coding"
|
||||
assert query_match.is_exact
|
||||
assert chip_match.key == "focus-coding"
|
||||
assert chip_match.is_exact
|
||||
|
||||
|
||||
def test_scenario_selection_falls_back_to_nearest_fixture() -> None:
|
||||
match = select_scenario("Focus while codign")
|
||||
|
||||
assert match.key == "focus-coding"
|
||||
assert not match.is_exact
|
||||
|
||||
|
||||
def test_prior_results_select_a_matching_refinement_or_same_scenario() -> None:
|
||||
refinement = select_replay_scenario("Focus while coding", True)
|
||||
direct_refinement = select_replay_scenario("More electronic", False)
|
||||
same_scenario = select_replay_scenario("Rainy Sunday", True)
|
||||
|
||||
assert refinement.key == "focus-coding-refine"
|
||||
assert not refinement.is_exact
|
||||
assert direct_refinement.key == "focus-coding-refine"
|
||||
assert direct_refinement.is_exact
|
||||
assert same_scenario.key == "rainy-sunday"
|
||||
Loading…
Add table
Add a link
Reference in a new issue