a06f331eb8
CI / benchmark (push) Has been skipped
install-script / posix-syntax (push) Successful in 6m1s
CI / build-onnx (push) Failing after 6m43s
init-smoke / dry-run (push) Failing after 15m57s
security / govulncheck (push) Has been cancelled
security / trivy-fs (push) Has been cancelled
CI / test (1.26, ubuntu-latest) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
CI / test (1.26, macos-latest) (push) Has been cancelled
CI / build-windows (push) Has been cancelled
CI / lint (push) Has been cancelled
install-script / powershell-syntax (push) Has been cancelled
install-script / install (macos-14) (push) Has been cancelled
install-script / install (ubuntu-latest) (push) Has been cancelled
50 lines
1.3 KiB
Go
50 lines
1.3 KiB
Go
package kiro
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/zzet/gortex/internal/agents"
|
|
"github.com/zzet/gortex/internal/agents/agentstest"
|
|
)
|
|
|
|
func TestKiroCreatesAllArtifactsAndIsIdempotent(t *testing.T) {
|
|
env, _ := agentstest.NewEnv(t)
|
|
// Sentinel: create .kiro/ so Detect returns true.
|
|
if err := os.MkdirAll(filepath.Join(env.Root, ".kiro"), 0o755); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
a := New()
|
|
|
|
res, err := a.Apply(env, agents.ApplyOpts{})
|
|
if err != nil {
|
|
t.Fatalf("apply: %v", err)
|
|
}
|
|
// 1 mcp.json + len(SteeringFiles) + len(HookFiles).
|
|
want := 1 + len(SteeringFiles) + len(HookFiles)
|
|
got := 0
|
|
for _, f := range res.Files {
|
|
if f.Action == agents.ActionCreate {
|
|
got++
|
|
}
|
|
}
|
|
if got != want {
|
|
t.Fatalf("expected %d creates, got %d (%v)", want, got, res.Files)
|
|
}
|
|
|
|
// autoApprove list is baked into the mcp.json entry — verify.
|
|
mcp := agentstest.ReadJSON(t, filepath.Join(env.Root, ".kiro", "settings", "mcp.json"))
|
|
servers := mcp["mcpServers"].(map[string]any)
|
|
gortex := servers["gortex"].(map[string]any)
|
|
approvals, ok := gortex["autoApprove"].([]any)
|
|
if !ok || len(approvals) == 0 {
|
|
t.Fatalf("autoApprove missing or empty: %v", gortex)
|
|
}
|
|
if gortex["disabled"] != false {
|
|
t.Fatalf("disabled should be false: %v", gortex)
|
|
}
|
|
|
|
agentstest.AssertIdempotent(t, a, env)
|
|
}
|