1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-06 17:41:00 +00:00

test(readability): add test case for ExtractContent with broken reader

This commit is contained in:
Frédéric Guillot 2025-07-01 20:04:22 -07:00
parent 8a98926674
commit 8c3f280f32
2 changed files with 15 additions and 2 deletions

View file

@ -400,8 +400,8 @@ func transformMisusedDivsIntoParagraphs(document *goquery.Document) {
"table", "ul":
return
default:
node := s.Get(0)
node.Data = "p"
currentNode := s.Get(0)
currentNode.Data = "p"
}
}
})

View file

@ -2479,3 +2479,16 @@ func TestCandidateStringEdgeCases(t *testing.T) {
}
})
}
func TestExtractContentWithBrokenReader(t *testing.T) {
if _, _, err := ExtractContent(&brokenReader{}); err == nil {
t.Error("Expected ExtractContent to return an error with broken reader")
}
}
// brokenReader implements io.Reader but always returns an error
type brokenReader struct{}
func (br *brokenReader) Read(p []byte) (n int, err error) {
return 0, fmt.Errorf("simulated read error")
}