Implemented the "copyItem(from: to: )" function for the FileService service in the library target.

This commit is contained in:
2025-01-14 23:52:33 +01:00
parent 26fde119ef
commit 489cf3d780
5 changed files with 73 additions and 0 deletions
@@ -51,6 +51,19 @@ extension FileServiceMock: FileServicing {
// MARK: Functions
func copyItem(from source: URL, to destination: URL) async throws (FileServiceError) {
guard let nextAction else { return }
switch nextAction {
case .error(let error):
throw error
case let .copyItem(source, destination):
try await spy?.copyItem(from: source, to: destination)
default:
break
}
}
func createFolder(at location: URL) async throws (FileServiceError) {
guard let nextAction else { return }
@@ -113,6 +126,7 @@ private extension FileServiceMock {
extension FileServiceMock {
enum Action {
case copyItem(URL, URL)
case createFolder(URL)
case deleteItem(URL)
case error(FileServiceError)