| 182 | } |
| 183 | |
| 184 | func 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 | |
| 211 | func TestSyncCommand_ParentShowsHelp(t *testing.T) { |
| 212 | // syncCmd should have no RunE — invoking it prints help |