Fix cache key transformed resources

Fixes #6348
This commit is contained in:
Bjørn Erik Pedersen
2019-09-19 10:12:29 +02:00
parent c0d7188ec8
commit 6dec671fb9
3 changed files with 61 additions and 31 deletions

View File

@@ -301,33 +301,3 @@ The content.
b.CreateSites().Build(BuildCfg{})
}
func TestBundleMany(t *testing.T) {
b := newTestSitesBuilder(t).WithSimpleConfigFile()
for i := 1; i <= 50; i++ {
b.WithContent(fmt.Sprintf("bundle%d/index.md", i), fmt.Sprintf(`
---
title: "Page %d"
---
`, i))
b.WithSourceFile(fmt.Sprintf("content/bundle%d/data.yaml", i), fmt.Sprintf(`
data: v%d
`, i))
}
b.WithTemplatesAdded("_default/single.html", `
{{ $yaml := .Resources.GetMatch "*.yaml" }}
{{ $data := $yaml | transform.Unmarshal }}
data content: {{ $yaml.Content | safeHTML }}
data unmarshaled: {{ $data.data }}
`)
b.CreateSites().Build(BuildCfg{})
for i := 1; i <= 50; i++ {
b.AssertFileContent(fmt.Sprintf("public/bundle%d/data.yaml", i), fmt.Sprintf("data: v%d", i))
b.AssertFileContent(fmt.Sprintf("public/bundle%d/index.html", i), fmt.Sprintf("data unmarshaled: v%d", i))
}
}