-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjsonfeed_test.go
More file actions
35 lines (28 loc) · 913 Bytes
/
jsonfeed_test.go
File metadata and controls
35 lines (28 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package jsonfeed_test
import (
"os"
"testing"
"github.com/jsvensson/jsonfeed"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
)
type JsonFeedTestSuite struct {
suite.Suite
feed jsonfeed.Feed
}
func TestJsonFeedSuite(t *testing.T) {
suite.Run(t, new(JsonFeedTestSuite))
}
func (t *JsonFeedTestSuite) SetupTest() {
input, err := os.Open("testdata/testfeed.json")
assert.NoError(t.T(), err, "unable to open test feed")
t.feed, err = jsonfeed.Parse(input)
assert.NoError(t.T(), err, "unable to parse test feed")
}
func (t *JsonFeedTestSuite) TestHasTopLevelFields() {
assert.Equal(t.T(), "My Example Feed", t.feed.Title)
assert.Equal(t.T(), "https://jsonfeed.org/version/1", t.feed.Version)
assert.Equal(t.T(), "https://example.org/", t.feed.HomePageURL)
assert.Equal(t.T(), "https://example.org/feed.json", t.feed.FeedURL)
assert.Equal(t.T(), 2, len(t.feed.Items))
}