Skip to content

Commit

Permalink
fix(BankSDKExample): Fix Sonar cloud issues in GalleryManagerTests
Browse files Browse the repository at this point in the history
PP-194
  • Loading branch information
zladzeyka committed Feb 3, 2025
1 parent 0811c93 commit 737b703
Showing 1 changed file with 27 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,29 @@ import Photos

final class GalleryManagerMock: GalleryManagerProtocol {
var isGalleryAccessLimited: Bool = false
var isCaching = false

var albums: [Album] = [Album(assets: [Asset(identifier: "Asset 1")],
title: "Album 1",
identifier: "Album 1"),
Album(assets: [Asset(identifier: "Asset 1"), Asset(identifier: "Asset 2")],
title: "Album 2",
identifier: "Album 2"),
Album(assets: [Asset(identifier: "Asset 1"), Asset(identifier: "Asset 2")],
title: "Album 3",
identifier: "Album 3")]
private let defaultAssets = [
Asset(identifier: "Asset 1"),
Asset(identifier: "Asset 2")
]

lazy var albums: [Album] = createMockAlbums()

private func createMockAlbums() -> [Album] {
return [
Album(assets: [defaultAssets[0]],
title: "Album 1",
identifier: "Album 1"),
Album(assets: defaultAssets,
title: "Album 2",
identifier: "Album 2"),
Album(assets: defaultAssets,
title: "Album 3",
identifier: "Album 3")
]
}

var isCaching = false

func reloadAlbums() {
}
Expand All @@ -36,15 +47,19 @@ final class GalleryManagerMock: GalleryManagerProtocol {
}

func fetchImageData(from asset: Asset, completion: @escaping ((Data?) -> Void)) {
completion(Data(count: 10))
completion(mockData())
}

func fetchRemoteImageData(from asset: Asset, completion: @escaping ((Data?) -> Void)) {
completion(Data(count: 10))
completion(mockData())
}

func fetchImage(from asset: Asset, imageQuality: ImageQuality, completion: @escaping ((UIImage) -> Void)) {
}

private func mockData() -> Data? {
return Data(count: 10)
}
}

extension Asset {
Expand Down

0 comments on commit 737b703

Please sign in to comment.