Restructured the folder structure of the test target.

This commit is contained in:
2025-01-17 23:23:10 +01:00
parent 04bd2a1160
commit 640683063e
9 changed files with 4 additions and 2 deletions
@@ -0,0 +1,51 @@
import Foundation
@testable import ColibriLibrary
final class FileServiceSpy {
// MARK: Properties
private(set) var actions: [Action] = []
}
// MARK: - FileServicing
extension FileServiceSpy: FileServicing {
var currentFolder: URL {
get async { .someCurrentFolder }
}
func copyItem(from source: URL, to destination: URL) async throws (FileServiceError) {
actions.append(.itemCopied(source, destination))
}
func createFolder(at location: URL) async throws (FileServiceError) {
actions.append(.folderCreated(location))
}
func deleteItem(at location: URL) async throws (FileServiceError) {
actions.append(.itemDeleted(location))
}
@discardableResult
func isItemExists(at location: URL) async throws (FileServiceError) -> Bool {
actions.append(.itemExists(location))
return .random()
}
}
// MARK: - Action
extension FileServiceSpy {
enum Action: Equatable {
case folderCreated(_ location: URL)
case itemCopied(_ source: URL, _ destination: URL)
case itemDeleted(_ location: URL)
case itemExists(_ location: URL)
}
}