Files
oddmu/feed_cmd_test.go
Alex Schroeder aca1d82fe0 Feed subcommand uses page name to determine date
The pubDate of the items in an archive feed should not be based on the
last modified time of the file because mass edits are irrelevant in
this context. The intended creation time is more important.
2025-12-31 20:28:41 +01:00

27 lines
712 B
Go

package main
import (
"bytes"
"testing"
"github.com/google/subcommands"
"github.com/stretchr/testify/assert"
)
func TestFeedCmd(t *testing.T) {
cleanup(t, "testdata/complete")
p := &Page{Name: "testdata/complete/2025-12-01", Body: []byte("# 2025-12-01\n")}
p.save()
p = &Page{Name: "testdata/complete/index", Body: []byte(`# Index
* [2025-12-01](2025-12-01)
`)}
p.save()
b := new(bytes.Buffer)
s := feedCli(b, []string{"testdata/complete/index.md"})
assert.Equal(t, subcommands.ExitSuccess, s)
assert.Contains(t, b.String(), "<fh:complete/>")
assert.Contains(t, b.String(), "<title>2025-12-01</title>")
assert.Contains(t, b.String(), "<pubDate>Mon, 01 Dec 2025 00:00:00") // ignore timezone
}