Restructured the folder structure in the library and test targets.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
|
||||
@testable import ColibriLibrary
|
||||
|
||||
struct CreateFoldersTaskTests {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
private let spy = FileServiceSpy()
|
||||
|
||||
// MARK: Functions tests
|
||||
|
||||
@Test(arguments: [URL.someCurrentFolder, .someDotFolder, .someTildeFolder])
|
||||
func createFolders(with rootFolder: URL) async throws {
|
||||
// GIVEN
|
||||
let folders = CreateFoldersTask.foldersToCreate.map { rootFolder.appendingPath($0) }
|
||||
let actions: [FileServiceMock.Action] = folders.map { .createFolder($0) }
|
||||
|
||||
let service = FileServiceMock(
|
||||
currentFolder: .someCurrentFolder,
|
||||
actions: actions,
|
||||
spy: spy
|
||||
)
|
||||
|
||||
let createFolders = CreateFoldersTask(fileService: service)
|
||||
|
||||
// WHEN
|
||||
try await createFolders(at: rootFolder)
|
||||
|
||||
// THEN
|
||||
for index in actions.indices {
|
||||
#expect(spy.actions[index] == .folderCreated(folders[index]))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user