Skip to content

Commit

Permalink
Don't compare UUID in test
Browse files Browse the repository at this point in the history
  • Loading branch information
Ceylo committed Dec 27, 2024
1 parent 2f6856e commit 74a4205
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
10 changes: 6 additions & 4 deletions FAKit/Sources/FAPages/FAUserGalleryLikePage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,26 @@ import Foundation
public struct FAFolderGroup: Sendable, Hashable, Identifiable {
public let title: String?
public let folders: [FAFolder]
public let id = UUID()
public let id: UUID

public init(title: String?, folders: [FAFolder]) {
public init(title: String?, folders: [FAFolder], id: UUID = UUID()) {
self.title = title
self.folders = folders
self.id = id
}
}

public struct FAFolder: Sendable, Hashable, Identifiable {
public let title: String
public let url: URL
public let isActive: Bool
public let id = UUID()
public let id: UUID

public init(title: String, url: URL, isActive: Bool) {
public init(title: String, url: URL, isActive: Bool, id: UUID = UUID()) {
self.title = title
self.url = url
self.isActive = isActive
self.id = id
}
}

Expand Down
21 changes: 20 additions & 1 deletion FAKit/Tests/FAPagesTests/FAUserGalleryLikePageTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,25 @@
import XCTest
@testable import FAPages

extension [FAFolderGroup] {
func ignoringUUID() -> Self {
map { $0.ignoringUUID() }
}
}

extension FAFolderGroup {
func ignoringUUID() -> Self {
let folders = self.folders.map { $0.ignoringUUID() }
return Self.init(title: title, folders: folders, id: UUID(uuid: UUID_NULL))
}
}

extension FAFolder {
func ignoringUUID() -> Self {
Self.init(title: title, url: url, isActive: isActive, id: UUID(uuid: UUID_NULL))
}
}

final class FAUserGalleryLikePageTests: XCTestCase {
let tiaamaitoFolders: [FAFolderGroup] = [
.init(title: "Gallery Folders", folders: [
Expand Down Expand Up @@ -78,7 +97,7 @@ final class FAUserGalleryLikePageTests: XCTestCase {
URL(string: "https://www.furaffinity.net/gallery/tiaamaito/2/")!,
page.nextPageUrl
)
XCTAssertEqual(tiaamaitoFolders, page.folderGroups)
XCTAssertEqual(tiaamaitoFolders.ignoringUUID(), page.folderGroups.ignoringUUID())
}

func testEmptyGalleryPage_parsedWithNoContent() async throws {
Expand Down

0 comments on commit 74a4205

Please sign in to comment.