feat: Sets up ci workflows
This commit is contained in:
@@ -24,6 +24,7 @@ struct ViewControllerTests {
|
||||
try await withDependencies {
|
||||
$0.viewController = .liveValue
|
||||
$0.database.employees = .mock
|
||||
$0.dateFormatter = .mock
|
||||
} operation: {
|
||||
@Dependency(\.viewController) var viewController
|
||||
@Dependency(\.database) var database
|
||||
@@ -54,6 +55,7 @@ struct ViewControllerTests {
|
||||
try await withSnapshotTesting(record: record) {
|
||||
try await withDependencies {
|
||||
$0.viewController = .liveValue
|
||||
$0.dateFormatter = .mock
|
||||
} operation: {
|
||||
@Dependency(\.viewController) var viewController
|
||||
|
||||
@@ -67,7 +69,7 @@ struct ViewControllerTests {
|
||||
func purchaseOrderViews() async throws {
|
||||
try await withSnapshotTesting(record: record) {
|
||||
try await withDependencies {
|
||||
$0.dateFormatter = .liveValue
|
||||
$0.dateFormatter = .mock
|
||||
$0.database.purchaseOrders = .mock
|
||||
$0.viewController = .liveValue
|
||||
} operation: {
|
||||
@@ -103,7 +105,7 @@ struct ViewControllerTests {
|
||||
func userViews() async throws {
|
||||
try await withSnapshotTesting(record: record) {
|
||||
try await withDependencies {
|
||||
$0.dateFormatter = .liveValue
|
||||
$0.dateFormatter = .mock
|
||||
$0.database.users = .mock
|
||||
$0.viewController = .liveValue
|
||||
} operation: {
|
||||
@@ -132,7 +134,7 @@ struct ViewControllerTests {
|
||||
func vendorViews() async throws {
|
||||
try await withSnapshotTesting(record: record) {
|
||||
try await withDependencies {
|
||||
$0.dateFormatter = .liveValue
|
||||
$0.dateFormatter = .mock
|
||||
$0.database.vendors = .mock
|
||||
$0.viewController = .liveValue
|
||||
} operation: {
|
||||
@@ -161,7 +163,7 @@ struct ViewControllerTests {
|
||||
func vendorBranchViews() async throws {
|
||||
try await withSnapshotTesting(record: record) {
|
||||
try await withDependencies {
|
||||
$0.dateFormatter = .liveValue
|
||||
$0.dateFormatter = .mock
|
||||
$0.database.vendors = .mock
|
||||
$0.database.vendorBranches = .mock
|
||||
$0.viewController = .liveValue
|
||||
@@ -271,7 +273,14 @@ extension DatabaseClient.VendorBranches {
|
||||
|
||||
extension Date {
|
||||
static var mock: Self {
|
||||
Date(timeIntervalSince1970: 1_234_567_890)
|
||||
let formatter = ISO8601DateFormatter()
|
||||
return formatter.date(from: "2025-01-31T02:22:40Z")!
|
||||
}
|
||||
}
|
||||
|
||||
extension DateFormatterKey {
|
||||
static var mock: Self {
|
||||
.init(string: { _ in "01/31/2025" })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,10 +288,10 @@ extension Employee {
|
||||
static var mock: Self {
|
||||
Employee(
|
||||
id: UUID(0),
|
||||
createdAt: Date(timeIntervalSince1970: 1_234_567_890),
|
||||
createdAt: .mock,
|
||||
firstName: "Testy",
|
||||
lastName: "McTestface",
|
||||
updatedAt: Date(timeIntervalSince1970: 1_234_567_890)
|
||||
updatedAt: .mock
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -296,10 +305,10 @@ extension Employee.Create {
|
||||
@Dependency(\.date.now) var now
|
||||
return .init(
|
||||
id: UUID(0),
|
||||
createdAt: Date(timeIntervalSince1970: 1_234_567_890),
|
||||
createdAt: .mock,
|
||||
firstName: firstName,
|
||||
lastName: lastName,
|
||||
updatedAt: Date(timeIntervalSince1970: 1_234_567_890)
|
||||
updatedAt: .mock
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,10 +24,10 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="label col-2">Created:</label>
|
||||
<h3 class="col-2">2/13/09</h3>
|
||||
<h3 class="col-2">01/31/2025</h3>
|
||||
<div class="col-1"></div>
|
||||
Updated:<label class="label col-2"></label>
|
||||
<h3 class="col-2">2/13/09</h3>
|
||||
<h3 class="col-2">01/31/2025</h3>
|
||||
</div>
|
||||
<div class="btn-row">
|
||||
<button class="btn-primary" type="submit">Update</button>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
Email:<label for="email" class="col-2"><span class="label"></span></label>
|
||||
<input class="col-4" type="email" id="email" name="email" value="test@example.com" required>
|
||||
</div>
|
||||
<div class="row"><span class="label col-2">Created:</span><span class="date col-4"></span><span class="label col-2">Updated:</span><span class="date col-4"></span></div>
|
||||
<div class="row"><span class="label col-2">Created:</span><span class="date col-4">01/31/2025</span><span class="label col-2">Updated:</span><span class="date col-4">01/31/2025</span></div>
|
||||
<div class="btn-row user-buttons">
|
||||
<button type="submit" class="btn-secondary">Update</button>
|
||||
<button class="danger" hx-delete="/api/v1/users/00000000-0000-0000-0000-000000000000" hx-trigger="click" hx-swap="outerHTML" hx-target="#user-00000000-0000-0000-0000-000000000000" hx-confirm="Are you sure you want to delete this user?" hx-on::after-request="toggleContent('float'); window.location.href='/users';">Delete</button>
|
||||
|
||||
Reference in New Issue
Block a user