forked from mirror/oddmu
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.
27 lines
712 B
Go
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
|
|
}
|