From a397b0fd4d5c95b6aef4eecbb13eabad3d7e659b Mon Sep 17 00:00:00 2001 From: Brooklyn Nicholson Date: Sat, 18 Apr 2026 09:16:39 -0500 Subject: [PATCH] test(tui-gateway): assert quick_commands appear in commands.catalog output --- tests/test_tui_gateway_server.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test_tui_gateway_server.py b/tests/test_tui_gateway_server.py index ea231e626..d441e2b32 100644 --- a/tests/test_tui_gateway_server.py +++ b/tests/test_tui_gateway_server.py @@ -363,6 +363,28 @@ def test_image_attach_appends_local_image(monkeypatch): assert len(server._sessions["sid"]["attached_images"]) == 1 +def test_commands_catalog_surfaces_quick_commands(monkeypatch): + monkeypatch.setattr(server, "_load_cfg", lambda: {"quick_commands": { + "build": {"type": "exec", "command": "npm run build"}, + "git": {"type": "alias", "target": "/shell git"}, + "notes": {"type": "exec", "command": "cat NOTES.md", "description": "Open design notes"}, + }}) + + resp = server.handle_request({"id": "1", "method": "commands.catalog", "params": {}}) + + pairs = dict(resp["result"]["pairs"]) + assert "npm run build" in pairs["/build"] + assert pairs["/git"].startswith("alias →") + assert pairs["/notes"] == "Open design notes" + + user_cat = next(c for c in resp["result"]["categories"] if c["name"] == "User commands") + user_pairs = dict(user_cat["pairs"]) + assert set(user_pairs) == {"/build", "/git", "/notes"} + + assert resp["result"]["canon"]["/build"] == "/build" + assert resp["result"]["canon"]["/notes"] == "/notes" + + def test_command_dispatch_exec_nonzero_surfaces_error(monkeypatch): monkeypatch.setattr(server, "_load_cfg", lambda: {"quick_commands": {"boom": {"type": "exec", "command": "boom"}}}) monkeypatch.setattr(