Implemented the TemplateService service in the library target.

This commit is contained in:
2025-02-04 21:57:47 +01:00
parent 1de9738e6e
commit a515747c21
6 changed files with 219 additions and 4 deletions
@@ -1,7 +1,6 @@
import ColibriLibrary
import Foundation
@testable import ColibriLibrary
final class FileServiceSpy {
// MARK: Properties
@@ -0,0 +1,38 @@
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 = ""
}