✨ Features: - App iOS completa para leer manga sin publicidad - Scraper con WKWebView para manhwaweb.com - Sistema de descargas offline - Lector con zoom y navegación - Favoritos y progreso de lectura - Compatible con iOS 15+ y Sideloadly/3uTools 📦 Contenido: - Backend Node.js con Puppeteer (opcional) - App iOS con SwiftUI - Scraper de capítulos e imágenes - Sistema de almacenamiento local - Testing completo - Documentación exhaustiva 🧪 Prueba: Capítulo 789 de One Piece descargado exitosamente - 21 páginas descargadas - 4.68 MB total - URLs verificadas y funcionales 🎉 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
161 lines
8.5 KiB
Swift
161 lines
8.5 KiB
Swift
import XCTest
|
|
|
|
#if !canImport(ObjectiveC)
|
|
return
|
|
#endif
|
|
|
|
/// Manifests para XCTest en Xcode
|
|
/// Este archivo ayuda a Xcode a descubrir y organizar los tests
|
|
|
|
// MARK: - Test Suites
|
|
|
|
final class ModelTestSuite: XCTestCase {
|
|
static let allTests = [
|
|
("testMangaInitialization", testMangaInitialization),
|
|
("testMangaCodableSerialization", testMangaCodableSerialization),
|
|
("testMangaDisplayStatus", testMangaDisplayStatus),
|
|
("testMangaHashable", testMangaHashable),
|
|
("testChapterInitialization", testChapterInitialization),
|
|
("testChapterDisplayNumber", testChapterDisplayNumber),
|
|
("testChapterProgress", testChapterProgress),
|
|
("testChapterCodableSerialization", testChapterCodableSerialization),
|
|
("testChapterHashable", testChapterHashable),
|
|
("testMangaPageInitialization", testMangaPageInitialization),
|
|
("testMangaPageThumbnailURL", testMangaPageThumbnailURL),
|
|
("testMangaPageCodableSerialization", testMangaPageCodableSerialization),
|
|
("testMangaPageHashable", testMangaPageHashable),
|
|
("testReadingProgressInitialization", testReadingProgressInitialization),
|
|
("testReadingProgressIsCompleted", testReadingProgressIsCompleted),
|
|
("testReadingProgressCodableSerialization", testReadingProgressCodableSerialization),
|
|
("testDownloadedChapterInitialization", testDownloadedChapterInitialization),
|
|
("testDownloadedChapterDisplayTitle", testDownloadedChapterDisplayTitle),
|
|
("testDownloadedChapterCodableSerialization", testDownloadedChapterCodableSerialization),
|
|
("testMangaWithEmptyGenres", testMangaWithEmptyGenres),
|
|
("testMangaWithNilCoverImage", testMangaWithNilCoverImage),
|
|
("testChapterWithZeroNumber", testChapterWithZeroNumber),
|
|
("testChapterWithLargePageNumber", testChapterWithLargePageNumber),
|
|
("testMangaPageWithNegativeIndex", testMangaPageWithNegativeIndex),
|
|
("testReadingProgressWithZeroPages", testReadingProgressWithZeroPages),
|
|
("testDownloadedChapterWithEmptyPages", testDownloadedChapterWithEmptyPages),
|
|
("testMangaEncodingPerformance", testMangaEncodingPerformance),
|
|
("testChapterArrayEqualityPerformance", testChapterArrayEqualityPerformance)
|
|
]
|
|
}
|
|
|
|
final class StorageServiceTestSuite: XCTestCase {
|
|
static let allTests = [
|
|
("testSaveFavorite", testSaveFavorite),
|
|
("testSaveMultipleFavorites", testSaveMultipleFavorites),
|
|
("testSaveDuplicateFavorite", testSaveDuplicateFavorite),
|
|
("testRemoveFavorite", testRemoveFavorite),
|
|
("testRemoveNonExistentFavorite", testRemoveNonExistentFavorite),
|
|
("testIsFavorite", testIsFavorite),
|
|
("testGetFavoritesWhenEmpty", testGetFavoritesWhenEmpty),
|
|
("testSaveReadingProgress", testSaveReadingProgress),
|
|
("testSaveMultipleReadingProgress", testSaveMultipleReadingProgress),
|
|
("testUpdateExistingReadingProgress", testUpdateExistingReadingProgress),
|
|
("testGetReadingProgressWhenNotExists", testGetReadingProgressWhenNotExists),
|
|
("testGetLastReadChapter", testGetLastReadChapter),
|
|
("testGetLastReadChapterWhenNoProgress", testGetGetLastReadChapterWhenNoProgress),
|
|
("testGetAllReadingProgressWhenEmpty", testGetAllReadingProgressWhenEmpty),
|
|
("testSaveDownloadedChapter", testSaveDownloadedChapter),
|
|
("testIsChapterDownloaded", testIsChapterDownloaded),
|
|
("testGetDownloadedChapters", testGetDownloadedChapters),
|
|
("testDeleteDownloadedChapter", testDeleteDownloadedChapter),
|
|
("testDeleteNonExistentDownloadedChapter", testDeleteNonExistentDownloadedChapter),
|
|
("testSaveAndLoadImage", testSaveAndLoadImage),
|
|
("testLoadNonExistentImage", testLoadNonExistentImage),
|
|
("testGetImageURL", testGetImageURL),
|
|
("testGetImageURLForNonExistentImage", testGetImageURLForNonExistentImage),
|
|
("testGetStorageSize", testGetStorageSize),
|
|
("testClearAllDownloads", testClearAllDownloads),
|
|
("testFormatFileSize", testFormatFileSize),
|
|
("testFormatFileSizeWithVariousSizes", testFormatFileSizeWithVariousSizes),
|
|
("testGetChapterDirectory", testGetChapterDirectory),
|
|
("testChapterDirectoryCreation", testChapterDirectoryCreation),
|
|
("testSaveFavoriteWithEmptySlug", testSaveFavoriteWithEmptySlug),
|
|
("testSaveFavoriteWithSpecialCharacters", testSaveFavoriteWithSpecialCharacters),
|
|
("testReadingProgressWithZeroPage", testReadingProgressWithZeroPage),
|
|
("testDownloadedChapterWithZeroChapterNumber", testDownloadedChapterWithZeroChapterNumber),
|
|
("testConcurrentImageSave", testConcurrentImageSave),
|
|
("testSaveManyFavoritesPerformance", testSaveManyFavoritesPerformance),
|
|
("testSaveManyReadingProgressPerformance", testSaveManyReadingProgressPerformance)
|
|
]
|
|
}
|
|
|
|
final class ManhwaWebScraperTestSuite: XCTestCase {
|
|
static let allTests = [
|
|
("testScrapingErrorDescriptions", testScrapingErrorDescriptions),
|
|
("testScrapingErrorLocalizedError", testScrapingErrorLocalizedError),
|
|
("testWebViewInitialization", testWebViewInitialization),
|
|
("testChapterParsingFromJavaScriptResult", testChapterParsingFromJavaScriptResult),
|
|
("testChapterParsingWithInvalidData", testChapterParsingWithInvalidData),
|
|
("testChapterDeduplication", testChapterDeduplication),
|
|
("testChapterSorting", testChapterSorting),
|
|
("testImageParsingFromJavaScriptResult", testImageParsingFromJavaScriptResult),
|
|
("testImageParsingWithEmptyArray", testImageParsingWithEmptyArray),
|
|
("testImageParsingWithInvalidURLs", testImageParsingWithInvalidURLs),
|
|
("testMangaInfoParsingFromJavaScriptResult", testMangaInfoParsingFromJavaScriptResult),
|
|
("testMangaInfoParsingWithEmptyFields", testMangaInfoParsingWithEmptyFields),
|
|
("testMangaStatusParsing", testMangaStatusParsing),
|
|
("testMangaURLConstruction", testMangaURLConstruction),
|
|
("testChapterURLConstruction", testChapterURLConstruction),
|
|
("testURLConstructionWithSpecialCharacters", testURLConstructionWithSpecialCharacters),
|
|
("testChapterNumberExtraction", testChapterNumberExtraction),
|
|
("testChapterSlugExtraction", testChapterSlugExtraction),
|
|
("testDuplicateRemovalPreservingOrder", testDuplicateRemovalPreservingOrder),
|
|
("testScraperIsMainActor", testScraperIsMainActor),
|
|
("testChapterParsingPerformance", testChapterParsingPerformance),
|
|
("testImageFilteringPerformance", testImageFilteringPerformance),
|
|
("testChapterSortingPerformance", testChapterSortingPerformance),
|
|
("testCompleteScrapingFlowSimulation", testCompleteScrapingFlowSimulation)
|
|
]
|
|
}
|
|
|
|
final class IntegrationTestSuite: XCTestCase {
|
|
static let allTests = [
|
|
("testCompleteScrapingAndStorageFlow", testCompleteScrapingAndStorageFlow),
|
|
("testChapterDownloadFlow", testChapterDownloadFlow),
|
|
("testReadingProgressTrackingFlow", testReadingProgressTrackingFlow),
|
|
("testFavoriteManagementFlow", testFavoriteManagementFlow),
|
|
("testMultipleMangasProgressTracking", testMultipleMangasProgressTracking),
|
|
("testMultipleChapterDownloads", testMultipleChapterDownloads),
|
|
("testDownloadFlowWithMissingImages", testDownloadFlowWithMissingImages),
|
|
("testStorageCleanupFlow", testStorageCleanupFlow),
|
|
("testDataPersistenceAcrossOperations", testDataPersistenceAcrossOperations),
|
|
("testConcurrentFavoriteOperations", testConcurrentFavoriteOperations),
|
|
("testConcurrentProgressOperations", testConcurrentProgressOperations),
|
|
("testConcurrentImageOperations", testConcurrentImageOperations),
|
|
("testLargeScaleFavoriteOperations", testLargeScaleFavoriteOperations),
|
|
("testLargeScaleProgressOperations", testLargeScaleProgressOperations)
|
|
]
|
|
}
|
|
|
|
// MARK: - All Tests Entry Point
|
|
|
|
#if DEBUG
|
|
|
|
/// Punto de entrada para ejecutar todos los tests
|
|
/// Esto es útil para debugging y para ejecutar tests programáticamente
|
|
final class AllTestsEntry {
|
|
static func runAllTests() {
|
|
print("🧪 MangaReader Test Suite")
|
|
print("=" * 50)
|
|
|
|
runTestSuite(ModelTestSuite.self)
|
|
runTestSuite(StorageServiceTestSuite.self)
|
|
runTestSuite(ManhwaWebScraperTestSuite.self)
|
|
runTestSuite(IntegrationTestSuite.self)
|
|
|
|
print("=" * 50)
|
|
print("✅ All tests completed!")
|
|
}
|
|
|
|
private static func runTestSuite(_ suiteClass: XCTestCase.Type) {
|
|
print("\n📋 Running \(suiteClass)...")
|
|
// La suite se ejecuta automáticamente por XCTest
|
|
}
|
|
}
|
|
|
|
#endif
|