Files
ThothII/tools/tht/cmd/tht/workspace_documents_test.go
T
Codex 64e6b9664a feat(cli): prepare and validate workspace documents offline
Reuse the runtime catalog and workspace parsers in a standalone helper paired with tht. Add document templates, safe diagnostics, local Evidence checks, native bundle builds, shared CLI fixtures and IT/EN preparation guides. Record the approved document-first specification and ticket breakdown. Refs #43.
2026-09-28 15:35:25 +02:00

30 lines
1011 B
Go

package main
import (
"bytes"
"context"
"encoding/json"
"testing"
)
func TestWorkspaceDocumentsNeedsPackagedHelperNotInstallation(t *testing.T) {
t.Setenv("PATH", "")
t.Setenv("THOTHII_INSTALLATION", "/nonexistent/installation.yaml")
for _, action := range []string{"prepare", "validate"} {
var stdout, stderr bytes.Buffer
status := run(context.Background(), []string{"workspace", action, "--directory", t.TempDir(), "--json"}, &stdout, &stderr)
var report struct {
OK bool `json:"ok"`
Issues []struct {
Code string `json:"code"`
} `json:"issues"`
}
if err := json.Unmarshal(stdout.Bytes(), &report); err != nil {
t.Fatalf("missing structured helper error: status=%d stdout=%s stderr=%s", status, &stdout, &stderr)
}
if status != 1 || report.OK || len(report.Issues) != 1 || report.Issues[0].Code != "workspace_helper_unavailable" || stderr.Len() != 0 {
t.Fatalf("unexpected missing-helper result: status=%d stdout=%s stderr=%s", status, &stdout, &stderr)
}
}
}