aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/Xe/jsonfeed/jsonfeed_test.go
diff options
context:
space:
mode:
authorChristine Dodrill <me@christine.website>2017-12-13 10:43:58 -0800
committerChristine Dodrill <me@christine.website>2017-12-13 11:42:37 -0800
commit3a21ef192628f6952eaa981bcdf718a35a4b43c7 (patch)
tree9c88a3ddc57ab5014f436ec2c08c96280872632e /vendor/github.com/Xe/jsonfeed/jsonfeed_test.go
parent3b4b6cede9bc30008b0f40989a1564b26e64fd05 (diff)
downloadxesite-3a21ef192628f6952eaa981bcdf718a35a4b43c7.tar.xz
xesite-3a21ef192628f6952eaa981bcdf718a35a4b43c7.zip
convert to go buildpack
Diffstat (limited to 'vendor/github.com/Xe/jsonfeed/jsonfeed_test.go')
-rw-r--r--vendor/github.com/Xe/jsonfeed/jsonfeed_test.go43
1 files changed, 43 insertions, 0 deletions
diff --git a/vendor/github.com/Xe/jsonfeed/jsonfeed_test.go b/vendor/github.com/Xe/jsonfeed/jsonfeed_test.go
new file mode 100644
index 0000000..29d9165
--- /dev/null
+++ b/vendor/github.com/Xe/jsonfeed/jsonfeed_test.go
@@ -0,0 +1,43 @@
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/
+
+package jsonfeed_test
+
+import (
+ "os"
+ "testing"
+ "time"
+
+ "github.com/st3fan/jsonfeed"
+ "github.com/stretchr/testify/assert"
+)
+
+func Test_ParseSimple(t *testing.T) {
+ r, err := os.Open("testdata/feed.json")
+ assert.NoError(t, err, "Could not open testdata/feed.json")
+
+ feed, err := jsonfeed.Parse(r)
+ assert.NoError(t, err, "Could not parse testdata/feed.json")
+
+ assert.Equal(t, "https://jsonfeed.org/version/1", feed.Version)
+ assert.Equal(t, "JSON Feed", feed.Title)
+ assert.Equal(t, "JSON Feed is a ...", feed.Description)
+ assert.Equal(t, "https://jsonfeed.org/", feed.HomePageURL)
+ assert.Equal(t, "https://jsonfeed.org/feed.json", feed.FeedURL)
+ assert.Equal(t, "This feed allows ...", feed.UserComment)
+ assert.Equal(t, "https://jsonfeed.org/graphics/icon.png", feed.Favicon)
+ assert.Equal(t, "Brent Simmons and Manton Reece", feed.Author.Name)
+
+ assert.Equal(t, 1, len(feed.Items))
+
+ assert.Equal(t, "https://jsonfeed.org/2017/05/17/announcing_json_feed", feed.Items[0].ID)
+ assert.Equal(t, "https://jsonfeed.org/2017/05/17/announcing_json_feed", feed.Items[0].URL)
+ assert.Equal(t, "Announcing JSON Feed", feed.Items[0].Title)
+ assert.Equal(t, "<p>We ...", feed.Items[0].ContentHTML)
+
+ datePublished, err := time.Parse("2006-01-02T15:04:05-07:00", "2017-05-17T08:02:12-07:00")
+ assert.NoError(t, err, "Could not parse timestamp")
+
+ assert.Equal(t, datePublished, feed.Items[0].DatePublished)
+}