atom_test.go 596 B

12345678910111213141516171819202122
  1. package feed
  2. import (
  3. "github.com/stretchr/testify/assert"
  4. "golang.org/x/tools/blog/atom"
  5. "testing"
  6. )
  7. func TestGetAtomFeed(t *testing.T) {
  8. var initfeed atom.Feed
  9. assert := assert.New(t)
  10. correctfeed, err := GetAtomFeed("https://blog.mavjs.org/feeds/all.atom.xml")
  11. assert.NotEmpty(correctfeed, "the returned feed should not be empty")
  12. assert.NoError(err, "there should be no error")
  13. incorrectfeed, err := GetAtomFeed("https://blog.mavjs.org/feeds/nall.atom.xml")
  14. assert.IsType(initfeed, incorrectfeed, "they should be the same type")
  15. assert.Error(err, "there should be an error")
  16. }