Allow deleting projects from the project picker with x/X.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -69,3 +69,25 @@ func TestJSONTimeStoreRoundTrip(t *testing.T) {
|
||||
t.Fatalf("after delete: %v len=%d path=%s", err, len(list), filepath.Join(dir, "time_entries.json"))
|
||||
}
|
||||
}
|
||||
|
||||
func TestJSONTimeStoreDeleteByProject(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
store := ticket.NewJSONTimeStore(dir)
|
||||
|
||||
for _, e := range []ticket.TimeEntry{
|
||||
{TicketID: "a", ProjectID: "p1", Duration: time.Hour, Source: ticket.SourceManual},
|
||||
{TicketID: "b", ProjectID: "p1", Duration: time.Minute, Source: ticket.SourceManual},
|
||||
{TicketID: "c", ProjectID: "p2", Duration: 30 * time.Minute, Source: ticket.SourceManual},
|
||||
} {
|
||||
if _, err := store.Create(e); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
if err := store.DeleteByProject("p1"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
list, err := store.List()
|
||||
if err != nil || len(list) != 1 || list[0].ProjectID != "p2" {
|
||||
t.Fatalf("after DeleteByProject: %v %+v", err, list)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user