Skip to content

Commit

Permalink
hugolib: Add test for homepage content for all rendering engines
Browse files Browse the repository at this point in the history
Update #4166
  • Loading branch information
bep committed Dec 29, 2017
1 parent c067f34 commit 407c240
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions hugolib/page_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
var emptyPage = ""

const (
homePage = "---\ntitle: Home\n---\nHome Page Content\n"
simplePage = "---\ntitle: Simple\n---\nSimple Page\n"
invalidFrontMatterMissing = "This is a test"
renderNoFrontmatter = "<!doctype><html><head></head><body>This is a test</body></html>"
Expand Down Expand Up @@ -595,12 +596,22 @@ func testAllMarkdownEnginesForPages(t *testing.T,
writeSource(t, fs, filepath.Join(contentDir, fileSourcePairs[i]), fileSourcePairs[i+1])
}

// Add a content page for the home page
homePath := fmt.Sprintf("_index.%s", e.ext)
writeSource(t, fs, filepath.Join(contentDir, homePath), homePage)

s := buildSingleSite(t, deps.DepsCfg{Fs: fs, Cfg: cfg}, BuildCfg{SkipRender: true})

require.Len(t, s.RegularPages, len(pageSources))

assertFunc(t, e.ext, s.RegularPages)

home, err := s.Info.Home()
require.NoError(t, err)
require.NotNil(t, home)
require.Equal(t, homePath, home.Path())
require.Contains(t, home.Content, "Home Page Content")

}

}
Expand Down

0 comments on commit 407c240

Please sign in to comment.