mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
hugolib: Add test for homepage content for all rendering engines
Update #4166
This commit is contained in:
parent
c067f34558
commit
407c24020e
1 changed files with 11 additions and 0 deletions
|
@ -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>"
|
||||
|
@ -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")
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue