From ab2fca82cf676583efc9a5897de0dd7f07c053ef Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 13:45:27 +0200 Subject: Return outcomes through ActionFacade --- tests/run.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests/run.lua') diff --git a/tests/run.lua b/tests/run.lua index 97a9a6d..7e49e62 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -7,6 +7,7 @@ package.path = table.concat({ }, ";") local domain = require("clever_f.domain") +local action_facade = require("clever_f.action_facade") local acquisition_service = require("clever_f.acquisition_service") local capabilities = require("clever_f.capabilities") local destination_engine = require("clever_f.destination_engine") @@ -7682,6 +7683,29 @@ test("Failed resolved primary search still refreshes highlight timeout", functio truthy(host:timers()[state.highlight_timer].active) end) +test("ActionFacade returns typed primary action outcomes", function() + fresh_sequence_state() + local host = MemoryHost.new({ + buffer_lines = { "aba" }, + input_packets = { { kind = "text", text = "b" } }, + configuration = { + mark_cursor = false, + mark_char = false, + }, + emit_movement_events = false, + }) + local facade = action_facade.new({ host = host }) + + local outcome = facade:primary("f") + + truthy(domain.ActionOutcome.is(outcome)) + same(domain.ActionKind.MOVEMENT, outcome.kind) + same(domain.Position.new(1, 2), outcome.position) + fails(function() + facade:primary("x") + end, "clever-f: Invalid mapping 'x'") +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then -- cgit v1.2.3