From 5a55900679cd87fe1ae9a2155f344ce066451316 Mon Sep 17 00:00:00 2001 From: Sergio Rubio Date: Sat, 23 Mar 2024 16:13:18 +0100 Subject: [PATCH] Test subscriptions --- api_test.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/api_test.go b/api_test.go index a11e902..899a888 100644 --- a/api_test.go +++ b/api_test.go @@ -8,11 +8,24 @@ import ( "github.com/stretchr/testify/assert" ) -func TestGetOrder(t *testing.T) { +func TestSearch(t *testing.T) { client := omnivore.NewClient(omnivore.Opts{Token: os.Getenv("OMNIVORE_API_TOKEN")}) // https://docs.omnivore.app/using/search.html - articles, err := client.Search(omnivore.SearchOpts{Query: "in:all"}) + articles, err := client.Search(omnivore.SearchOpts{Query: "in:all -label:RSS"}) assert.NoError(t, err, "Failed to search") assert.Equal(t, len(articles), 3) assert.Equal(t, articles[0].Title, "Organize your Omnivore library with labels") + + articles, err = client.Search(omnivore.SearchOpts{Query: "in:all label:RSS"}) + assert.NoError(t, err, "Failed to search") + assert.Equal(t, len(articles), 1) + assert.Equal(t, articles[0].Title, "Web changes for an improved experience") +} + +func TestSubcriptions(t *testing.T) { + client := omnivore.NewClient(omnivore.Opts{Token: os.Getenv("OMNIVORE_API_TOKEN")}) + subscriptions, err := client.Subscriptions() + assert.NoError(t, err, "Failed to get subscriptions") + assert.Equal(t, len(subscriptions), 1) + assert.Equal(t, subscriptions[0].Name, "Omnivore Blog") }