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

Function TestSyncCommand_InvalidConflictFlag

apps/cli/internal/cli/sync_test.go:184–209  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

182}
183
184func TestSyncCommand_InvalidConflictFlag(t *testing.T) {
185 syncDryRun = false
186 syncSource = ""
187 syncConflict = "invalid"
188
189 tmpDir := t.TempDir()
190 origDir, _ := os.Getwd()
191 if err := os.Chdir(tmpDir); err != nil {
192 t.Fatal(err)
193 }
194 defer os.Chdir(origDir)
195
196 // Write a valid config so we get past config loading
197 configContent := "sync:\n sources:\n - name: test\n output_dir: \"tasks\"\n"
198 if err := os.WriteFile(filepath.Join(tmpDir, ".taskmd.yaml"), []byte(configContent), 0644); err != nil {
199 t.Fatal(err)
200 }
201
202 err := runSync(syncDownCmd, nil)
203 if err == nil {
204 t.Fatal("expected error for invalid --conflict value")
205 }
206 if !strings.Contains(err.Error(), "invalid --conflict") {
207 t.Errorf("unexpected error message: %v", err)
208 }
209}
210
211func TestSyncCommand_ParentShowsHelp(t *testing.T) {
212 // syncCmd should have no RunE — invoking it prints help

Callers

nothing calls this directly

Calls 2

runSyncFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected