Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-03-08 15:45:33 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-03-27 16:43:56 +0300
commitc8fff9501d424882a42f750800d9982ec47df640 (patch)
tree03b49241a12ddcf98212959b8e3c7f954ae94685 /hugolib/site_output_test.go
parent3ec5fc35043639e7592819014180666b1a8e926b (diff)
Implement the first generic JSON output testcase
Diffstat (limited to 'hugolib/site_output_test.go')
-rw-r--r--hugolib/site_output_test.go49
1 files changed, 49 insertions, 0 deletions
diff --git a/hugolib/site_output_test.go b/hugolib/site_output_test.go
index c449c6541..03c5b7394 100644
--- a/hugolib/site_output_test.go
+++ b/hugolib/site_output_test.go
@@ -17,6 +17,10 @@ import (
"reflect"
"testing"
+ "github.com/stretchr/testify/require"
+
+ "fmt"
+
"github.com/spf13/hugo/output"
)
@@ -41,3 +45,48 @@ func TestDefaultOutputDefinitions(t *testing.T) {
})
}
}
+
+func TestSiteWithJSONHomepage(t *testing.T) {
+ t.Parallel()
+
+ siteConfig := `
+baseURL = "http://example.com/blog"
+
+paginate = 1
+defaultContentLanguage = "en"
+
+disableKinds = ["page", "section", "taxonomy", "taxonomyTerm", "RSS", "sitemap", "robotsTXT", "404"]
+
+[Taxonomies]
+tag = "tags"
+category = "categories"
+`
+
+ pageTemplate := `---
+title: "%s"
+outputs: ["json"]
+---
+# Doc
+`
+
+ th, h := newTestSitesFromConfigWithDefaultTemplates(t, siteConfig)
+ require.Len(t, h.Sites, 1)
+
+ fs := th.Fs
+
+ writeSource(t, fs, "content/_index.md", fmt.Sprintf(pageTemplate, "JSON Home"))
+
+ err := h.Build(BuildCfg{})
+
+ require.NoError(t, err)
+
+ s := h.Sites[0]
+ home := s.getPage(KindHome)
+
+ require.NotNil(t, home)
+
+ require.Len(t, home.outputTypes, 1)
+
+ th.assertFileContent("public/index.json", "TODO")
+
+}