Skip to content

Commit

Permalink
Update parser tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chihchy committed Oct 27, 2024
1 parent fec539c commit 3c47d1f
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 142 deletions.
22 changes: 11 additions & 11 deletions EhPandaTests/Resources/Parser/Gallery/GalleryDetail.html

Large diffs are not rendered by default.

219 changes: 108 additions & 111 deletions EhPandaTests/Resources/Parser/Other/EhSetting.html

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions EhPandaTests/Tests/Parser/Gallery/GalleryDetailParserTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@ class GalleryDetailParserTests: XCTestCase, TestHelper {
let document = try htmlDocument(filename: .galleryDetail)
let (detail, state) = try Parser.parseGalleryDetail(doc: document, gid: "2725078")
XCTAssertEqual(detail.gid, "2725078")
XCTAssertEqual(detail.title, "●PIXIV● HYYT [67227995]")
XCTAssertEqual(detail.jpnTitle, nil)
XCTAssertEqual(detail.title, "[Artist] mks")
XCTAssertEqual(detail.jpnTitle, "[アーティスト] mks")
XCTAssertFalse(detail.isFavorited)
XCTAssertEqual(detail.visibility, .yes)
XCTAssertEqual(detail.rating, 4.5)
XCTAssertEqual(detail.userRating, 0)
XCTAssertEqual(detail.ratingCount, 569)
XCTAssertEqual(detail.category, .imageSet)
XCTAssertEqual(detail.ratingCount, 108)
XCTAssertEqual(detail.category, .nonH)
XCTAssertEqual(detail.language, .japanese)
XCTAssertEqual(detail.uploader, "KEYLUN")
XCTAssertEqual(detail.coverURL?.absoluteString, "https://ehgt.org/5e/b5/5eb550886fe58da8c780d9ab9182717ae9bcda91-604248-2235-3016-jpg_250.jpg")
XCTAssertEqual(detail.archiveURL?.absoluteString, "https://e-hentai.org/archiver.php?gid=0000000&token=0000000000&or=471924--76094077f7be1ee86673ef75c45e0d382961dc9c")
XCTAssertEqual(detail.parentURL?.absoluteString, "https://e-hentai.org/g/2624293/78cf5e78a5/")
XCTAssertEqual(detail.favoritedCount, 9218)
XCTAssertEqual(detail.pageCount, 612)
XCTAssertEqual(detail.sizeCount, 657.6)
XCTAssertEqual(detail.uploader, "Pokom")
XCTAssertEqual(detail.coverURL?.absoluteString, "https://ehgt.org/03/08/0308268821e99628b05a19fa54e2fc0fa9ad8f4b-1705560-1012-1470-png_250.jpg")
XCTAssertEqual(detail.archiveURL?.absoluteString, "https://e-hentai.org/archiver.php?gid=3103480&token=0000000000&or=480566--44111f81616a100ccab3d9be8ac8b5adedb5d44e")
XCTAssertEqual(detail.parentURL?.absoluteString, "https://e-hentai.org/g/2930572/daf4b9880d/")
XCTAssertEqual(detail.favoritedCount, 587)
XCTAssertEqual(detail.pageCount, 156)
XCTAssertEqual(detail.sizeCount, 314.3)
XCTAssertEqual(detail.sizeType, "MiB")
XCTAssertEqual(detail.torrentCount, 5)
XCTAssertEqual(state.tags.count, 4)
XCTAssertEqual(detail.torrentCount, 1)
XCTAssertEqual(state.tags.count, 1)
XCTAssertEqual(state.previewURLs.count, 40)
XCTAssertEqual(state.previewConfig, .normal(rows: 4))
XCTAssertEqual(state.comments.count, 49)
XCTAssertEqual(state.comments.count, 10)
}
}
12 changes: 6 additions & 6 deletions EhPandaTests/Tests/Parser/Other/EhSettingParserTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import XCTest
class EhSettingParserTests: XCTestCase, TestHelper {
func testExample() throws {
let document = try htmlDocument(filename: .ehSetting)
let ehSetting = try Parser.parseEhSetting(doc: document)
let ehSetting = try Parser.parseEhSetting(doc: document, galleryHost: .ehentai)
testEhProfiles(ehSetting.ehProfiles)
testCapability(ehSetting: ehSetting)
testRemainingStuff(ehSetting: ehSetting)
Expand Down Expand Up @@ -45,8 +45,8 @@ class EhSettingParserTests: XCTestCase, TestHelper {
XCTAssertEqual(ehSetting.capableSearchResultCount, .oneHundred)
XCTAssertEqual(ehSetting.capableSearchResultCounts, [.twentyFive, .fifty, .oneHundred])

XCTAssertEqual(ehSetting.capableThumbnailConfigSize, .large)
XCTAssertEqual(ehSetting.capableThumbnailConfigSizes, EhSetting.ThumbnailSize.allCases)
XCTAssertEqual(ehSetting.thumbnailConfigSize, .normal)
XCTAssertEqual(ehSetting.capableThumbnailConfigSizes, [.normal, .large])

XCTAssertEqual(ehSetting.capableThumbnailConfigRowCount, .forty)
XCTAssertEqual(ehSetting.capableThumbnailConfigRowCounts, EhSetting.ThumbnailRowCount.allCases)
Expand Down Expand Up @@ -75,16 +75,16 @@ class EhSettingParserTests: XCTestCase, TestHelper {
XCTAssertEqual(ehSetting.showFilteredRemovalCount, true)
XCTAssertEqual(ehSetting.excludedLanguages, .init(repeating: false, count: 50))
XCTAssertEqual(ehSetting.excludedUploaders, "")
XCTAssertEqual(ehSetting.searchResultCount, .twentyFive)
XCTAssertEqual(ehSetting.searchResultCount, .oneHundred)
XCTAssertEqual(ehSetting.thumbnailLoadTiming, .onMouseOver)
XCTAssertEqual(ehSetting.thumbnailConfigSize, .large)
XCTAssertEqual(ehSetting.thumbnailConfigSize, .normal)
XCTAssertEqual(ehSetting.thumbnailConfigRows, .four)
XCTAssertEqual(ehSetting.thumbnailScaleFactor, 100)
XCTAssertEqual(ehSetting.viewportVirtualWidth, 0)
XCTAssertEqual(ehSetting.commentsSortOrder, .oldest)
XCTAssertEqual(ehSetting.commentVotesShowTiming, .onHoverOrClick)
XCTAssertEqual(ehSetting.tagsSortOrder, .alphabetical)
XCTAssertEqual(ehSetting.galleryShowPageNumbers, false)
XCTAssertEqual(ehSetting.galleryPageNumbering, .none)
XCTAssertEqual(ehSetting.useOriginalImages, false)
XCTAssertEqual(ehSetting.useMultiplePageViewer, true)
XCTAssertEqual(ehSetting.multiplePageViewerStyle, .alignLeftScaleIfOverWidth)
Expand Down

0 comments on commit 3c47d1f

Please sign in to comment.