test: improve the test to work with multiple converter in the future

This commit is contained in:
Antoine Aflalo
2024-08-27 10:26:18 -04:00
parent 068564e87e
commit 86923862a9

View File

@@ -1,4 +1,4 @@
package webp
package converter
import (
"bytes"
@@ -35,6 +35,12 @@ func TestConvertChapter(t *testing.T) {
}
defer os.Remove(temp.Name())
for _, converter := range Available() {
converter, err := Get(converter)
if err != nil {
t.Fatalf("failed to get converter: %v", err)
}
t.Run(converter.Format().String(), func(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
chapter, err := tc.genTestChapter(temp.Name())
@@ -42,7 +48,6 @@ func TestConvertChapter(t *testing.T) {
t.Fatalf("failed to load test genTestChapter: %v", err)
}
converter := New()
quality := uint8(80)
progress := func(msg string) {
@@ -65,6 +70,8 @@ func TestConvertChapter(t *testing.T) {
}
})
}
})
}
}
func loadTestChapterSplit(path string) (*packer.Chapter, error) {