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

Function TestWebStart_FileInsteadOfDirectory

apps/cli/internal/cli/web_test.go:31–50  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

29}
30
31func TestWebStart_FileInsteadOfDirectory(t *testing.T) {
32 resetWebFlags()
33
34 tmpDir := t.TempDir()
35 filePath := filepath.Join(tmpDir, "not-a-dir.txt")
36 if err := os.WriteFile(filePath, []byte("hello"), 0644); err != nil {
37 t.Fatalf("failed to create test file: %v", err)
38 }
39
40 taskDir = filePath
41
42 err := runWebStart(webStartCmd, nil)
43 if err == nil {
44 t.Fatal("expected error when task-dir points to a file")
45 }
46
47 if !strings.Contains(err.Error(), "not a valid directory") {
48 t.Errorf("expected 'not a valid directory' error, got: %v", err)
49 }
50}

Callers

nothing calls this directly

Calls 3

resetWebFlagsFunction · 0.85
runWebStartFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected