summaryrefslogtreecommitdiffstats
path: root/hugolib/sitemap_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-02-07 15:56:56 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-02-07 15:56:56 +0100
commit05c8bccf84624d3905258c32c8f258bc9eb315c5 (patch)
tree5154e437d2b7c952bbd5bd8839a1b1d8fae39319 /hugolib/sitemap_test.go
parentb3c2d90ba238b1b701a0fcb3b8ab7f32af2935f1 (diff)
hugolib: Add test for parseSitemap
Diffstat (limited to 'hugolib/sitemap_test.go')
-rw-r--r--hugolib/sitemap_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/hugolib/sitemap_test.go b/hugolib/sitemap_test.go
index 13bc92a18..bb3eaccd2 100644
--- a/hugolib/sitemap_test.go
+++ b/hugolib/sitemap_test.go
@@ -22,6 +22,7 @@ import (
"github.com/spf13/hugo/hugofs"
"github.com/spf13/hugo/source"
"github.com/spf13/viper"
+ "reflect"
)
const SITEMAP_TEMPLATE = `<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
@@ -83,3 +84,19 @@ func TestSitemapOutput(t *testing.T) {
t.Errorf("Sitemap file should start with <?xml. %s", sitemap)
}
}
+
+func TestParseSitemap(t *testing.T) {
+ expected := Sitemap{Priority: 3.0, Filename: "doo.xml", ChangeFreq: "3"}
+ input := map[string]interface{}{
+ "changefreq": "3",
+ "priority": 3.0,
+ "filename": "doo.xml",
+ "unknown": "ignore",
+ }
+ result := parseSitemap(input)
+
+ if !reflect.DeepEqual(expected, result) {
+ t.Errorf("Got \n%v expected \n%v", result, expected)
+ }
+
+}