colibri/Test/Sources/Helpers/Spies/TemplateServiceSpy.swift
Javier Cicchelli 212ca52279 Template support for input parameters (#4)
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>
2025-02-17 22:11:05 +00:00

39 lines
698 B
Swift

import ColibriLibrary
final class TemplateServiceSpy {
// MARK: Properties
private(set) var actions: [Action] = []
}
// MARK: - TemplateServicing
extension TemplateServiceSpy: TemplateServicing {
// MARK: Functions
@discardableResult
func render(_ object: Any, on template: String) async throws (TemplateServiceError) -> String {
actions.append(.rendered(object, template))
return .content
}
}
// MARK: - Actions
extension TemplateServiceSpy {
enum Action {
case rendered(_ object: Any, _ template: String)
}
}
// MARK: - String+Constants
private extension String {
static let content = ""
}