MCPcopy Create free account
hub / github.com/driangle/taskmd / TestSpecCommand_OverwritesWithForce

Function TestSpecCommand_OverwritesWithForce

apps/cli/internal/cli/spec_test.go:61–86  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

59}
60
61func TestSpecCommand_OverwritesWithForce(t *testing.T) {
62 tmpDir := t.TempDir()
63
64 existingPath := filepath.Join(tmpDir, specFilename)
65 if err := os.WriteFile(existingPath, []byte("old content"), 0644); err != nil {
66 t.Fatalf("failed to create existing file: %v", err)
67 }
68
69 specForce = true
70 specStdout = false
71 taskDir = tmpDir
72
73 err := runSpec(specCmd, []string{})
74 if err != nil {
75 t.Fatalf("unexpected error with --force: %v", err)
76 }
77
78 content, err := os.ReadFile(existingPath)
79 if err != nil {
80 t.Fatalf("failed to read file: %v", err)
81 }
82
83 if !bytes.Equal(content, specTemplate) {
84 t.Error("file should have been overwritten with spec content")
85 }
86}
87
88func TestSpecCommand_StdoutPrintsWithoutCreatingFile(t *testing.T) {
89 tmpDir := t.TempDir()

Callers

nothing calls this directly

Calls 2

runSpecFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected