37 lines
638 B
Swift
37 lines
638 B
Swift
|
@testable import DoxyLibrary
|
||
|
|
||
|
struct FileServiceMock {
|
||
|
|
||
|
// MARK: Properties
|
||
|
|
||
|
private let error: FileServiceError?
|
||
|
private let items: [String]
|
||
|
|
||
|
// MARK: Initialisers
|
||
|
|
||
|
init(
|
||
|
items: [String] = [],
|
||
|
error: FileServiceError? = nil
|
||
|
) {
|
||
|
self.error = error
|
||
|
self.items = items
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
// MARK: - FileServicing
|
||
|
|
||
|
extension FileServiceMock: FileServicing {
|
||
|
|
||
|
// MARK: Functions
|
||
|
|
||
|
func listItems(in folder: String) async throws(FileServiceError) -> [String] {
|
||
|
if let error {
|
||
|
throw error
|
||
|
}
|
||
|
|
||
|
return items
|
||
|
}
|
||
|
|
||
|
}
|