INNER CODE UNIT · Go
TestBatchWithHeadersAndFooters
miniscruff/changie · cmd/batch_test.go:345
func TestBatchWithHeadersAndFooters(t *testing.T) {
cfg := batchTestConfig()
cfg.VersionHeaderPath = "h2.md"
cfg.VersionFooterPath = "f2.md"
cfg.HeaderFormat = "header format"
cfg.FooterFormat = "footer format"
then.WithTempDirConfig(t, cfg)
batch := NewBatch(time.Now, core.NewTemplateCache())
batch.VersionHeaderPath = "h1.md"
batch.VersionFooterPath = "f1.md"
writeChangeFile(t, cfg, &core.Change{Kind: "added", Body: "A"})
writeChangeFile(t, cfg, &core.Change{Kind: "added", Body: "B"})
writeChangeFile(t, cfg, &core.Change{Kind: "removed", Body: "C"})
then.WriteFile(t, []byte("first header\n"), cfg.ChangesDir, cfg.UnreleasedDir, "h1.md")
then.WriteFile(t, []byte("second header\n"), cfg.ChangesDir, cfg.UnreleasedDir, "h2.md")