Implemented the TemplateService service in the library target.
This commit is contained in:
@@ -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 = ""
|
||||
}
|
||||
Reference in New Issue
Block a user