| 870 | } |
| 871 | |
| 872 | func TestRefreshShowsDirectoryWithPrdMdOnly(t *testing.T) { |
| 873 | tmpDir := t.TempDir() |
| 874 | prdsDir := filepath.Join(tmpDir, ".chief", "prds") |
| 875 | |
| 876 | // Create directory with only prd.md (no json yet) |
| 877 | prdDir := filepath.Join(prdsDir, "in-progress") |
| 878 | if err := os.MkdirAll(prdDir, 0755); err != nil { |
| 879 | t.Fatalf("Failed to create dir: %v", err) |
| 880 | } |
| 881 | if err := os.WriteFile(filepath.Join(prdDir, "prd.md"), []byte("# My PRD"), 0644); err != nil { |
| 882 | t.Fatalf("Failed to create prd.md: %v", err) |
| 883 | } |
| 884 | |
| 885 | p := &PRDPicker{ |
| 886 | basePath: tmpDir, |
| 887 | entries: make([]PRDEntry, 0), |
| 888 | } |
| 889 | p.Refresh() |
| 890 | |
| 891 | if len(p.entries) != 1 { |
| 892 | t.Fatalf("expected 1 entry for directory with prd.md, got %d", len(p.entries)) |
| 893 | } |
| 894 | if p.entries[0].Name != "in-progress" { |
| 895 | t.Errorf("expected entry name 'in-progress', got %q", p.entries[0].Name) |
| 896 | } |
| 897 | } |
| 898 | |
| 899 | func TestRefreshSkipsDirectoryWithOnlyPrdJson(t *testing.T) { |
| 900 | tmpDir := t.TempDir() |