mirror of
https://github.com/miniflux/v2.git
synced 2025-06-27 16:36:00 +00:00
Use truncated entry description as title if unavailable
This commit is contained in:
parent
c9e0f0b3e4
commit
1eb01b39e7
10 changed files with 314 additions and 24 deletions
|
@ -115,7 +115,7 @@ func TestParseFeedWithoutTitle(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestParseEntryWithoutTitle(t *testing.T) {
|
||||
func TestParseEntryWithoutTitleAndDescription(t *testing.T) {
|
||||
data := `<?xml version="1.0" encoding="utf-8"?>
|
||||
<rss version="2.0">
|
||||
<channel>
|
||||
|
@ -136,6 +136,30 @@ func TestParseEntryWithoutTitle(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestParseEntryWithoutTitleButWithDescription(t *testing.T) {
|
||||
data := `<?xml version="1.0" encoding="utf-8"?>
|
||||
<rss version="2.0">
|
||||
<channel>
|
||||
<link>https://example.org/</link>
|
||||
<item>
|
||||
<link>https://example.org/item</link>
|
||||
<description>
|
||||
This is the description
|
||||
</description>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>`
|
||||
|
||||
feed, err := Parse("https://example.org/", bytes.NewBufferString(data))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if feed.Entries[0].Title != "This is the description" {
|
||||
t.Errorf("Incorrect entry title, got: %s", feed.Entries[0].Title)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseEntryWithMediaTitle(t *testing.T) {
|
||||
data := `<?xml version="1.0" encoding="utf-8"?>
|
||||
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue