33 lines
953 B
Swift
33 lines
953 B
Swift
import Foundation
|
|
import Testing
|
|
|
|
@testable import ColibriLibrary
|
|
|
|
struct InitGitInFolderTaskTests {
|
|
|
|
// MARK: Properties
|
|
|
|
private let spy = TerminalServiceSpy()
|
|
|
|
// MARK:
|
|
|
|
@Test(arguments: [URL.someCurrentFolder, .someNewFolder, .someDotFolder, .someTildeFolder])
|
|
func task(at rootFolder: URL) async throws {
|
|
// GIVEN
|
|
let initGitInFolder = InitGitInFolderTask(terminalService: spy)
|
|
|
|
// WHEN
|
|
try await initGitInFolder(at: rootFolder)
|
|
|
|
// THEN
|
|
let executableURL = URL(at: "/usr/bin/git")
|
|
let pathFolder = rootFolder.pathString
|
|
|
|
#expect(spy.actions.count == 3)
|
|
#expect(spy.actions[0] == .ran(executableURL, ["init", pathFolder]))
|
|
#expect(spy.actions[1] == .ran(executableURL, ["-C", pathFolder, "add", "."]))
|
|
#expect(spy.actions[2] == .ran(executableURL, ["-C", pathFolder, "commit", "-m", "Initial commit"]))
|
|
}
|
|
|
|
}
|