feat: Initial view controller dependency and snapshot tests.

This commit is contained in:
2025-01-23 10:57:20 -05:00
parent c74433c2eb
commit 5695d0e13c
49 changed files with 2802 additions and 1 deletions

View File

@@ -0,0 +1,31 @@
import Dependencies
import DependenciesMacros
import Elementary
import SharedModels
public extension DependencyValues {
var viewController: ViewController {
get { self[ViewController.self] }
set { self[ViewController.self] = newValue }
}
}
@DependencyClient
public struct ViewController: Sendable {
public typealias AuthenticateHandler = @Sendable (User) -> Void
public var view: @Sendable (ViewRoute, Bool, @escaping AuthenticateHandler) async throws -> (any HTML)?
@Sendable
public func view(
for route: ViewRoute,
isHtmxRequest: Bool,
authenticate: @escaping AuthenticateHandler
) async throws -> (any HTML)? {
try await view(route, isHtmxRequest, authenticate)
}
}
extension ViewController: TestDependencyKey {
public static let testValue: ViewController = Self()
}