mirror of
https://github.com/Belphemur/CBZOptimizer.git
synced 2025-10-14 04:28:51 +02:00
fix: naming issue
This commit is contained in:
@@ -295,15 +295,16 @@ func TestConverter_convertPage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConverter_convertPage_WithCorruptedImage(t *testing.T) {
|
func TestConverter_convertPage_EncodingError(t *testing.T) {
|
||||||
converter := New()
|
converter := New()
|
||||||
err := converter.PrepareConverter()
|
err := converter.PrepareConverter()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Create a corrupted PNG image by creating a page with invalid data
|
// Create a test case with nil image to test encoding error path
|
||||||
|
// when isToBeConverted is true but the image is nil, simulating a failure in the encoding step
|
||||||
corruptedPage := &manga.Page{
|
corruptedPage := &manga.Page{
|
||||||
Index: 1,
|
Index: 1,
|
||||||
Contents: &bytes.Buffer{}, // Empty buffer - should cause decode error
|
Contents: &bytes.Buffer{}, // Empty buffer
|
||||||
Extension: ".png",
|
Extension: ".png",
|
||||||
Size: 0,
|
Size: 0,
|
||||||
}
|
}
|
||||||
@@ -312,7 +313,7 @@ func TestConverter_convertPage_WithCorruptedImage(t *testing.T) {
|
|||||||
|
|
||||||
converted, err := converter.convertPage(container, 80)
|
converted, err := converter.convertPage(container, 80)
|
||||||
|
|
||||||
// This should return nil container and error because decode will fail with "image: unknown format"
|
// This should return nil container and error because encoding will fail with nil image
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
assert.Nil(t, converted)
|
assert.Nil(t, converted)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user