feat: Fixes release build failures and get's release dockerfile working.

This commit is contained in:
2025-01-24 16:47:00 -05:00
parent 90c6058d56
commit 978ce8c74f
38 changed files with 233 additions and 217 deletions

View File

@@ -101,80 +101,86 @@ struct ViewControllerTests {
@Test
func userViews() async throws {
try await withDependencies {
$0.dateFormatter = .liveValue
$0.database.users = .mock
$0.viewController = .liveValue
} operation: {
@Dependency(\.database) var database
@Dependency(\.viewController) var viewController
try await withSnapshotTesting(record: record) {
try await withDependencies {
$0.dateFormatter = .liveValue
$0.database.users = .mock
$0.viewController = .liveValue
} operation: {
@Dependency(\.database) var database
@Dependency(\.viewController) var viewController
var htmlString = try await viewController.render(.user(.index))
assertSnapshot(of: htmlString, as: .html)
var htmlString = try await viewController.render(.user(.index))
assertSnapshot(of: htmlString, as: .html)
htmlString = try await viewController.render(.user(.form))
assertSnapshot(of: htmlString, as: .html)
htmlString = try await viewController.render(.user(.form))
assertSnapshot(of: htmlString, as: .html)
htmlString = try await viewController.render(.user(.create(.mock)))
assertSnapshot(of: htmlString, as: .html)
htmlString = try await viewController.render(.user(.create(.mock)))
assertSnapshot(of: htmlString, as: .html)
htmlString = try await viewController.render(.user(.get(id: UUID(0))))
assertSnapshot(of: htmlString, as: .html)
htmlString = try await viewController.render(.user(.get(id: UUID(0))))
assertSnapshot(of: htmlString, as: .html)
htmlString = try await viewController.render(.user(.update(id: UUID(0), updates: .mock)))
assertSnapshot(of: htmlString, as: .html)
htmlString = try await viewController.render(.user(.update(id: UUID(0), updates: .mock)))
assertSnapshot(of: htmlString, as: .html)
}
}
}
@Test
func vendorViews() async throws {
try await withDependencies {
$0.dateFormatter = .liveValue
$0.database.vendors = .mock
$0.viewController = .liveValue
} operation: {
@Dependency(\.database) var database
@Dependency(\.viewController) var viewController
try await withSnapshotTesting(record: record) {
try await withDependencies {
$0.dateFormatter = .liveValue
$0.database.vendors = .mock
$0.viewController = .liveValue
} operation: {
@Dependency(\.database) var database
@Dependency(\.viewController) var viewController
var htmlString = try await viewController.render(.vendor(.index))
assertSnapshot(of: htmlString, as: .html)
var htmlString = try await viewController.render(.vendor(.index))
assertSnapshot(of: htmlString, as: .html)
htmlString = try await viewController.render(.vendor(.form))
assertSnapshot(of: htmlString, as: .html)
htmlString = try await viewController.render(.vendor(.form))
assertSnapshot(of: htmlString, as: .html)
htmlString = try await viewController.render(.vendor(.create(.mock)))
assertSnapshot(of: htmlString, as: .html)
htmlString = try await viewController.render(.vendor(.create(.mock)))
assertSnapshot(of: htmlString, as: .html)
htmlString = try await viewController.render(.vendor(.get(id: UUID(0))))
assertSnapshot(of: htmlString, as: .html)
htmlString = try await viewController.render(.vendor(.get(id: UUID(0))))
assertSnapshot(of: htmlString, as: .html)
htmlString = try await viewController.render(.vendor(.update(id: UUID(0), updates: .mock)))
assertSnapshot(of: htmlString, as: .html)
htmlString = try await viewController.render(.vendor(.update(id: UUID(0), updates: .mock)))
assertSnapshot(of: htmlString, as: .html)
}
}
}
@Test
func vendorBranchViews() async throws {
try await withDependencies {
$0.dateFormatter = .liveValue
$0.database.vendors = .mock
$0.database.vendorBranches = .mock
$0.viewController = .liveValue
} operation: {
@Dependency(\.database) var database
@Dependency(\.viewController) var viewController
try await withSnapshotTesting(record: record) {
try await withDependencies {
$0.dateFormatter = .liveValue
$0.database.vendors = .mock
$0.database.vendorBranches = .mock
$0.viewController = .liveValue
} operation: {
@Dependency(\.database) var database
@Dependency(\.viewController) var viewController
var htmlString = try await viewController.render(.vendorBranch(.index(for: UUID(0))))
assertSnapshot(of: htmlString, as: .html)
var htmlString = try await viewController.render(.vendorBranch(.index(for: UUID(0))))
assertSnapshot(of: htmlString, as: .html)
htmlString = try await viewController.render(.vendorBranch(.select(context: .purchaseOrderSearch)))
assertSnapshot(of: htmlString, as: .html)
htmlString = try await viewController.render(.vendorBranch(.select(context: .purchaseOrderSearch)))
assertSnapshot(of: htmlString, as: .html)
htmlString = try await viewController.render(.vendorBranch(.select(context: .purchaseOrderForm)))
assertSnapshot(of: htmlString, as: .html)
htmlString = try await viewController.render(.vendorBranch(.select(context: .purchaseOrderForm)))
assertSnapshot(of: htmlString, as: .html)
htmlString = try await viewController.render(.vendorBranch(.create(.mock)))
assertSnapshot(of: htmlString, as: .html)
htmlString = try await viewController.render(.vendorBranch(.create(.mock)))
assertSnapshot(of: htmlString, as: .html)
}
}
}
}
@@ -182,14 +188,12 @@ struct ViewControllerTests {
extension ViewController {
func render(_ route: ViewRoute) async throws -> String {
guard let html = try await view(
let html = try await view(
for: route,
isHtmxRequest: true,
logger: .init(label: "tests"),
authenticate: { _ in }
) else {
throw TestError()
}
)
return html.renderFormatted()
}

View File

@@ -10,7 +10,7 @@
</div>
<div class="btn-row">
<button type="submit" class="btn-primary">Update</button>
<button class="danger" hx-confirm="Are you sure you want to delete this employee?" hx-delete="/employees/00000000-0000-0000-0000-000000000000" hx-target="#employee-00000000-0000-0000-0000-000000000000" hx-swap="outerHTML transition:true swap:1s">Delete</button>
<button class="danger" hx-confirm="Are you sure you want to delete this employee?" hx-delete="/api/v1/employees/00000000-0000-0000-0000-000000000000" hx-target="#employee-00000000-0000-0000-0000-000000000000" hx-swap="outerHTML transition:true swap:1s">Delete</button>
</div>
</form>
</div>

View File

@@ -12,7 +12,7 @@
<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="btn-row user-buttons">
<button type="submit" class="btn-secondary">Update</button>
<button class="danger" hx-delete="/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>
<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>
</div>
</form>
</div>

View File

@@ -1,7 +1,7 @@
<ul id="branch-list">
<li id="branch-00000000-0000-0000-0000-000000000001" class="branch-row">
<span class="label">Mock</span>
<button class="btn" hx-delete="/vendors/branches/00000000-0000-0000-0000-000000000001" hx-target="#branch-00000000-0000-0000-0000-000000000001" hx-swap="outerHTML transition:true swap:0.5s">
<button class="btn" hx-delete="/api/v1/vendors/branches/00000000-0000-0000-0000-000000000001" hx-target="#branch-00000000-0000-0000-0000-000000000001" hx-swap="outerHTML transition:true swap:0.5s">
<img src="/images/trash-can.svg" width="30" height="30" style="margin-top: 5px;">
</button>
</li>

View File

@@ -1,6 +1,6 @@
<li id="branch-00000000-0000-0000-0000-000000000001" class="branch-row">
<span class="label">Mock</span>
<button class="btn" hx-delete="/vendors/branches/00000000-0000-0000-0000-000000000001" hx-target="#branch-00000000-0000-0000-0000-000000000001" hx-swap="outerHTML transition:true swap:0.5s">
<button class="btn" hx-delete="/api/v1/vendors/branches/00000000-0000-0000-0000-000000000001" hx-target="#branch-00000000-0000-0000-0000-000000000001" hx-swap="outerHTML transition:true swap:0.5s">
<img src="/images/trash-can.svg" width="30" height="30" style="margin-top: 5px;">
</button>
</li>

View File

@@ -6,7 +6,7 @@
<form id="vendor-form" hx-put="/vendors/00000000-0000-0000-0000-000000000000" hx-target="#content" hx-swap="outerHTML">
<div class="row">
<input type="text" class="col-9" id="vendor-name" name="name" value="Test" placeholder="Vendor Name" hx-put="/vendors/00000000-0000-0000-0000-000000000000" hx-trigger="keyup changed delay:500ms" required>
<button class="danger" style="font-size: 1.25em; padding: 10px 20px; border-radius: 10px;" hx-delete="/vendors/00000000-0000-0000-0000-000000000000" hx-confirm="Are you sure you want to delete this vendor?" hx-target="#vendor-00000000-0000-0000-0000-000000000000" hx-swap="outerHTML transition:true swap:1s" hx-on::after-request="if(event.detail.successful) toggleContent('float'); window.location.href='/vendors';">Delete</button>
<button class="danger" style="font-size: 1.25em; padding: 10px 20px; border-radius: 10px;" hx-delete="/api/v1/vendors/00000000-0000-0000-0000-000000000000" hx-confirm="Are you sure you want to delete this vendor?" hx-target="#vendor-00000000-0000-0000-0000-000000000000" hx-swap="outerHTML transition:true swap:1s" hx-on::after-request="if(event.detail.successful) toggleContent('float'); window.location.href='/vendors';">Delete</button>
<button type="submit" class="btn-primary" style="float: right">Update</button>
</div>
</form>

View File

@@ -5,7 +5,7 @@
<form id="vendor-form" hx-put="/vendors/00000000-0000-0000-0000-000000000000" hx-target="#content" hx-swap="outerHTML">
<div class="row">
<input type="text" class="col-9" id="vendor-name" name="name" value="Test" placeholder="Vendor Name" hx-put="/vendors/00000000-0000-0000-0000-000000000000" hx-trigger="keyup changed delay:500ms" required>
<button class="danger" style="font-size: 1.25em; padding: 10px 20px; border-radius: 10px;" hx-delete="/vendors/00000000-0000-0000-0000-000000000000" hx-confirm="Are you sure you want to delete this vendor?" hx-target="#vendor-00000000-0000-0000-0000-000000000000" hx-swap="outerHTML transition:true swap:1s" hx-on::after-request="if(event.detail.successful) toggleContent('float'); window.location.href='/vendors';">Delete</button>
<button class="danger" style="font-size: 1.25em; padding: 10px 20px; border-radius: 10px;" hx-delete="/api/v1/vendors/00000000-0000-0000-0000-000000000000" hx-confirm="Are you sure you want to delete this vendor?" hx-target="#vendor-00000000-0000-0000-0000-000000000000" hx-swap="outerHTML transition:true swap:1s" hx-on::after-request="if(event.detail.successful) toggleContent('float'); window.location.href='/vendors';">Delete</button>
<button type="submit" class="btn-primary" style="float: right">Update</button>
</div>
</form>

View File

@@ -5,7 +5,7 @@
<form id="vendor-form" hx-put="/vendors/00000000-0000-0000-0000-000000000000" hx-target="#content" hx-swap="outerHTML">
<div class="row">
<input type="text" class="col-9" id="vendor-name" name="name" value="Test" placeholder="Vendor Name" hx-put="/vendors/00000000-0000-0000-0000-000000000000" hx-trigger="keyup changed delay:500ms" required>
<button class="danger" style="font-size: 1.25em; padding: 10px 20px; border-radius: 10px;" hx-delete="/vendors/00000000-0000-0000-0000-000000000000" hx-confirm="Are you sure you want to delete this vendor?" hx-target="#vendor-00000000-0000-0000-0000-000000000000" hx-swap="outerHTML transition:true swap:1s" hx-on::after-request="if(event.detail.successful) toggleContent('float'); window.location.href='/vendors';">Delete</button>
<button class="danger" style="font-size: 1.25em; padding: 10px 20px; border-radius: 10px;" hx-delete="/api/v1/vendors/00000000-0000-0000-0000-000000000000" hx-confirm="Are you sure you want to delete this vendor?" hx-target="#vendor-00000000-0000-0000-0000-000000000000" hx-swap="outerHTML transition:true swap:1s" hx-on::after-request="if(event.detail.successful) toggleContent('float'); window.location.href='/vendors';">Delete</button>
<button type="submit" class="btn-primary" style="float: right">Update</button>
</div>
</form>