Reset Password (#1)

Implements reset password routes, views, and tests.

Reviewed-on: #1
This commit is contained in:
2025-01-27 14:07:37 +00:00
parent 1f2bb900ca
commit 9478fae371
16 changed files with 250 additions and 7 deletions

View File

@@ -101,6 +101,25 @@ struct ViewControllerTests {
}
}
@Test
func resetPasswordViews() async throws {
try await withSnapshotTesting(record: record) {
try await withDependencies {
$0.dateFormatter = .mock
$0.database.users = .mock
$0.viewController = .liveValue
} operation: {
@Dependency(\.viewController) var viewController
var htmlString = try await viewController.render(.resetPassword(.index(id: UUID(0))))
assertSnapshot(of: htmlString, as: .html)
htmlString = try await viewController.render(.resetPassword(.submit(id: UUID(0), request: .mock)))
assertSnapshot(of: htmlString, as: .html)
}
}
}
@Test
func userViews() async throws {
try await withSnapshotTesting(record: record) {
@@ -240,6 +259,7 @@ extension DatabaseClient.Users {
get: { _ in User.mock },
login: { _ in User.Token.mock },
logout: { _ in },
resetPassword: { _, _ in },
token: { _ in User.Token.mock },
update: { _, _ in User.mock }
)
@@ -407,3 +427,9 @@ extension PurchaseOrder.Create {
)
}
}
extension User.ResetPassword {
static var mock: Self {
.init(password: "super-secret", confirmPassword: "super-secret")
}
}