mirror of
https://github.com/miniflux/v2.git
synced 2025-08-26 18:21:01 +00:00
Add API routes for "mark all as read"
This commit is contained in:
parent
eeeea74bf1
commit
e17d395ae7
8 changed files with 217 additions and 0 deletions
|
@ -324,6 +324,38 @@ func TestUpdateFeedCategory(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestMarkFeedAsRead(t *testing.T) {
|
||||
client := createClient(t)
|
||||
|
||||
feed, _ := createFeed(t, client)
|
||||
|
||||
results, err := client.FeedEntries(feed.ID, nil)
|
||||
if err != nil {
|
||||
t.Fatalf(`Failed to get entries: %v`, err)
|
||||
}
|
||||
if results.Total == 0 {
|
||||
t.Fatalf(`Invalid number of entries: %d`, results.Total)
|
||||
}
|
||||
if results.Entries[0].Status != miniflux.EntryStatusUnread {
|
||||
t.Fatalf(`Invalid entry status, got %q instead of %q`, results.Entries[0].Status, miniflux.EntryStatusUnread)
|
||||
}
|
||||
|
||||
if err := client.MarkFeedAsRead(feed.ID); err != nil {
|
||||
t.Fatalf(`Failed to mark feed as read: %v`, err)
|
||||
}
|
||||
|
||||
results, err = client.FeedEntries(feed.ID, nil)
|
||||
if err != nil {
|
||||
t.Fatalf(`Failed to get updated entries: %v`, err)
|
||||
}
|
||||
|
||||
for _, entry := range results.Entries {
|
||||
if entry.Status != miniflux.EntryStatusRead {
|
||||
t.Errorf(`Status for entry %d was %q instead of %q`, entry.ID, entry.Status, miniflux.EntryStatusRead)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeleteFeed(t *testing.T) {
|
||||
client := createClient(t)
|
||||
feed, _ := createFeed(t, client)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue