Skip to content

Commit 5cbe958

Browse files
committed
Added positive and negative tests for Goose integration
1 parent 6af35e4 commit 5cbe958

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

tests/integrations/test_integration_goose.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
"""Tests for GooseIntegration."""
22

3+
import yaml
4+
from specify_cli.integrations import get_integration
5+
from specify_cli.integrations.base import YamlIntegration
6+
from specify_cli.integrations.manifest import IntegrationManifest
7+
38
from .test_integration_base_yaml import YamlIntegrationTests
49

510

@@ -9,3 +14,38 @@ class TestGooseIntegration(YamlIntegrationTests):
914
COMMANDS_SUBDIR = "recipes"
1015
REGISTRAR_DIR = ".goose/recipes"
1116
CONTEXT_FILE = "AGENTS.md"
17+
18+
def test_setup_declares_args_parameter_for_args_prompt(self, tmp_path):
19+
# “If a Goose recipe uses {{args}}, it correctly declares the args parameter.”
20+
integration = get_integration("goose")
21+
manifest = IntegrationManifest("goose", tmp_path)
22+
23+
created = integration.setup(tmp_path, manifest, script_type="sh")
24+
25+
recipe_files = [path for path in created if path.suffix == ".yaml"]
26+
assert recipe_files
27+
28+
for recipe_file in recipe_files:
29+
data = yaml.safe_load(recipe_file.read_text(encoding="utf-8"))
30+
31+
if "{{args}}" not in data["prompt"]:
32+
continue
33+
34+
assert any(
35+
param.get("key") == "args"
36+
for param in data.get("parameters", [])
37+
), f"{recipe_file} uses {{args}} but does not declare args"
38+
39+
def test_base_yaml_renderer_does_not_declare_args_parameter(self):
40+
# “Without the Goose-specific override, recipes using {{args}} do NOT declare it.”
41+
rendered = YamlIntegration._render_yaml(
42+
"Test",
43+
"Test recipe",
44+
"{{args}}",
45+
"templates/commands/test.md",
46+
)
47+
48+
data = yaml.safe_load(rendered)
49+
50+
assert "{{args}}" in data["prompt"]
51+
assert "parameters" not in data

0 commit comments

Comments
 (0)