This PR contains the work done to support input parameters for the `create` command of the executable target, and to render content dynamically for the newly-generated project. Reviewed-on: #4 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
31 lines
1008 B
Swift
31 lines
1008 B
Swift
import Foundation
|
|
import Testing
|
|
|
|
@testable import ColibriLibrary
|
|
|
|
struct InitGitInFolderTaskTests {
|
|
|
|
// MARK: Functions tests
|
|
|
|
@Test(arguments: [URL.someCurrentFolder, .someNewFolder, .someDotFolder, .someTildeFolder])
|
|
func task(at rootFolder: URL) async throws {
|
|
// GIVEN
|
|
let terminalService = TerminalServiceSpy()
|
|
|
|
let initGitInFolder = InitGitInFolderTask(terminalService: terminalService)
|
|
|
|
// WHEN
|
|
try await initGitInFolder(at: rootFolder)
|
|
|
|
// THEN
|
|
let executableURL = URL(at: "/usr/bin/git")
|
|
let pathFolder = rootFolder.pathString
|
|
|
|
#expect(terminalService.actions.count == 3)
|
|
#expect(terminalService.actions[0] == .ran(executableURL, ["init", pathFolder]))
|
|
#expect(terminalService.actions[1] == .ran(executableURL, ["-C", pathFolder, "add", "."]))
|
|
#expect(terminalService.actions[2] == .ran(executableURL, ["-C", pathFolder, "commit", "-m", "Initial commit"]))
|
|
}
|
|
|
|
}
|