-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IOS-9553. Add unit tests for file management view model and related U…
…C and Repos
- Loading branch information
Showing
8 changed files
with
260 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
Modules/Domain/MEGADomain/Sources/MEGADomainMock/MockUseCases/MockCacheUseCase.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import Foundation | ||
import MEGADomain | ||
|
||
public final class MockCacheUseCase: CacheUseCaseProtocol, @unchecked Sendable { | ||
private var _cacheSize: UInt64 | ||
public var cleanCache_calledTimes = 0 | ||
|
||
public init(cacheSize: UInt64) { | ||
_cacheSize = cacheSize | ||
} | ||
|
||
public func cacheSize() throws -> UInt64 { | ||
_cacheSize | ||
} | ||
|
||
public func cleanCache() async throws { | ||
_cacheSize = 0 | ||
cleanCache_calledTimes += 1 | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
Modules/Domain/MEGADomain/Sources/MEGADomainMock/MockUseCases/MockMobileDataUseCase.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import Foundation | ||
import MEGADomain | ||
|
||
public final class MockMobileDataUseCase: MobileDataUseCaseProtocol { | ||
private var _isEnabled = false | ||
|
||
public init(isEnabled: Bool = false) { | ||
_isEnabled = isEnabled | ||
} | ||
|
||
public func isMobileDataForPreviewingEnabled() -> Bool { | ||
_isEnabled | ||
} | ||
|
||
public func updateMobileDataForPreviewingEnabled(_ enabled: Bool) { | ||
_isEnabled = enabled | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.