from GramAddict.core.goap import GoalPlanner, ScreenType


def test_semantic_heuristic_match_blank_start():
    planner = GoalPlanner("testuser")
    # Simulate an empty knowledge base
    planner.knowledge._learned_screen_mappings = {}

    # Simulate being on ExploreGrid
    screen = {
        "screen_type": ScreenType.EXPLORE_GRID,
        "available_actions": ["press back", "tap profile tab", "tap reels tab", "tap explore tab", "tap home tab"],
        "context": {},
    }

    action = planner.plan_next_step("open profile", screen)
    assert action == "tap profile tab", f"Expected 'tap profile tab', got {action}"

    action2 = planner.plan_next_step("open home feed", screen)
    assert action2 == "tap home tab", f"Expected 'tap home tab', got {action2}"
