Skip to content

Commit

Permalink
Test subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
rubiojr committed Mar 23, 2024
1 parent 52c740e commit 5a55900
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

0 comments on commit 5a55900

Please sign in to comment.