feat: Updates to check if playbook is installed prior to running any of the commands, updates tests.
This commit is contained in:
@@ -23,7 +23,11 @@ struct FileClientTests {
|
||||
let fileClient = FileClient.liveValue
|
||||
|
||||
let vaultFilePath = url.appending(path: fileName)
|
||||
FileManager.default.createFile(atPath: vaultFilePath.cleanFilePath, contents: nil)
|
||||
#if os(Linux)
|
||||
_ = FileManager.default.createFile(atPath: vaultFilePath.cleanFilePath, contents: nil)
|
||||
#else
|
||||
FileManager.default.createFile(atPath: vaultFilePath.cleanFilePath, contents: nil)
|
||||
#endif
|
||||
let output = try await fileClient.findVaultFile(url)!
|
||||
|
||||
#expect(output.cleanFilePath == vaultFilePath.cleanFilePath)
|
||||
@@ -43,7 +47,11 @@ struct FileClientTests {
|
||||
try await fileClient.createDirectory(subDir)
|
||||
|
||||
let vaultFilePath = subDir.appending(path: fileName)
|
||||
FileManager.default.createFile(atPath: vaultFilePath.cleanFilePath, contents: nil)
|
||||
#if os(Linux)
|
||||
_ = FileManager.default.createFile(atPath: vaultFilePath.cleanFilePath, contents: nil)
|
||||
#else
|
||||
FileManager.default.createFile(atPath: vaultFilePath.cleanFilePath, contents: nil)
|
||||
#endif
|
||||
let output = try await fileClient.findVaultFile(url)!
|
||||
|
||||
#expect(output.cleanFilePath == vaultFilePath.cleanFilePath)
|
||||
|
||||
@@ -145,6 +145,7 @@ struct PlaybookClientTests: TestCase {
|
||||
@Test
|
||||
func generateTemplate() async throws {
|
||||
try await withCapturingCommandClient("generateTemplate") {
|
||||
$0.fileClient.isDirectory = { _ in true }
|
||||
$0.configurationClient = .mock()
|
||||
$0.playbookClient = .liveValue
|
||||
} run: {
|
||||
@@ -180,6 +181,7 @@ struct PlaybookClientTests: TestCase {
|
||||
operation: @Sendable @escaping () async throws -> Void
|
||||
) async rethrows {
|
||||
try await withDependencies {
|
||||
$0.fileClient.isDirectory = { _ in true }
|
||||
$0.configurationClient = .mock(configuration)
|
||||
$0.commandClient = .capturing(capturing)
|
||||
$0.playbookClient = .liveValue
|
||||
|
||||
Reference in New Issue
Block a user