Improved the naming of the functions for the FileServicing protocol in the library target.

This commit is contained in:
2025-01-13 23:27:50 +01:00
parent df556f83ab
commit 26fde119ef
6 changed files with 69 additions and 69 deletions
@@ -42,7 +42,7 @@ final class FileServiceMock {
// MARK: - FileServicing
extension FileServiceMock: FileServicing {
// MARK: Computed
var currentFolder: URL {
@@ -51,40 +51,40 @@ extension FileServiceMock: FileServicing {
// MARK: Functions
func createFolder(at url: URL) async throws(FileServiceError) {
func createFolder(at location: URL) async throws (FileServiceError) {
guard let nextAction else { return }
switch nextAction {
case .error(let error):
throw error
case let .createFolder(url):
try await spy?.createFolder(at: url)
case let .createFolder(location):
try await spy?.createFolder(at: location)
default:
break
}
}
func delete(at url: URL) async throws(FileServiceError) {
func deleteItem(at location: URL) async throws (FileServiceError) {
guard let nextAction else { return }
switch nextAction {
case .error(let error):
throw error
case let .delete(url):
try await spy?.delete(at: url)
case let .deleteItem(location):
try await spy?.deleteItem(at: location)
default:
break
}
}
func exists(at url: URL) async throws(FileServiceError) -> Bool {
func isItemExists(at location: URL) async throws (FileServiceError) -> Bool {
guard let nextAction else { return false }
switch nextAction {
case .error(let error):
throw error
case let .exists(url, exists):
try await spy?.exists(at: url)
case let .isItemExists(location, exists):
try await spy?.isItemExists(at: location)
return exists
default:
return false
@@ -114,8 +114,8 @@ private extension FileServiceMock {
extension FileServiceMock {
enum Action {
case createFolder(URL)
case delete(URL)
case deleteItem(URL)
case error(FileServiceError)
case exists(URL, Bool)
case isItemExists(URL, Bool)
}
}