mirror of
https://github.com/Belphemur/CBZOptimizer.git
synced 2025-10-14 12:38:50 +02:00
feat: init with converting cbz files
This commit is contained in:
30
cbz/cbz_loader_test.go
Normal file
30
cbz/cbz_loader_test.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package cbz
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestLoadChapter(t *testing.T) {
|
||||
// Define the path to the .cbz file
|
||||
chapterFilePath := "../testdata/Chapter 1.cbz"
|
||||
|
||||
// Load the chapter
|
||||
chapter, err := LoadChapter(chapterFilePath)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to load chapter: %v", err)
|
||||
}
|
||||
|
||||
// Check the number of pages
|
||||
expectedPages := 16
|
||||
actualPages := len(chapter.Pages)
|
||||
if actualPages != expectedPages {
|
||||
t.Errorf("Expected %d pages, but got %d", expectedPages, actualPages)
|
||||
}
|
||||
|
||||
// Check if ComicInfoXml contains the expected series name
|
||||
expectedSeries := "<Series>Boundless Necromancer</Series>"
|
||||
if !strings.Contains(chapter.ComicInfoXml, expectedSeries) {
|
||||
t.Errorf("ComicInfoXml does not contain the expected series: %s", expectedSeries)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user