Improved upon the implementation of the "callAsFunction(at: )" function for the CreateFoldersTask task in the library target.
This commit is contained in:
@@ -14,19 +14,12 @@ struct CreateFoldersTaskTests {
|
||||
@Test(arguments: [URL.someCurrentFolder, .someDotFolder, .someTildeFolder])
|
||||
func createFolders(with rootFolder: URL) async throws {
|
||||
// GIVEN
|
||||
let folderApp = rootFolder.appendingPath("Sources/App")
|
||||
let folderAppInfrastructure = rootFolder.appendingPath("Sources/AppInfrastructure")
|
||||
let folderTestSources = rootFolder.appendingPath("Test/App/Sources")
|
||||
let folderTestCases = rootFolder.appendingPath("Test/App/Cases")
|
||||
|
||||
let folders = CreateFoldersTask.foldersToCreate.map { rootFolder.appendingPath($0) }
|
||||
let actions: [FileServiceMock.Action] = folders.map { .createFolder($0) }
|
||||
|
||||
let service = FileServiceMock(
|
||||
currentFolder: .someCurrentFolder,
|
||||
actions: [
|
||||
.createFolder(folderApp),
|
||||
.createFolder(folderAppInfrastructure),
|
||||
.createFolder(folderTestSources),
|
||||
.createFolder(folderTestCases),
|
||||
],
|
||||
actions: actions,
|
||||
spy: spy
|
||||
)
|
||||
|
||||
@@ -36,10 +29,9 @@ struct CreateFoldersTaskTests {
|
||||
try await createFolders(at: rootFolder)
|
||||
|
||||
// THEN
|
||||
#expect(spy.actions[0] == .folderCreated(folderApp))
|
||||
#expect(spy.actions[1] == .folderCreated(folderAppInfrastructure))
|
||||
#expect(spy.actions[2] == .folderCreated(folderTestSources))
|
||||
#expect(spy.actions[3] == .folderCreated(folderTestCases))
|
||||
for index in actions.indices {
|
||||
#expect(spy.actions[index] == .folderCreated(folders[index]))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user