Moved test database teardown into defer blocks and unified the one-decimal formatting in the Website service.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
06953a1be0
commit
e0524da525
16 files changed
+118
-146
No files matched your search
+14
-18
@@ -156,27 +156,23 @@ private extension PasskeyControllerTests {
|
||||
logger: Logger(label: "test")
|
||||
)()
|
||||
|
||||
do {
|
||||
await PrepareDB()(for: fluent)
|
||||
|
||||
try await fluent.migrate()
|
||||
|
||||
let router = Router(context: WebsiteRequestContext.self)
|
||||
|
||||
router.addRoutes(PasskeyController<WebsiteRequestContext>(
|
||||
origin: "http://localhost:8080",
|
||||
accounts: .init(fluent: fluent),
|
||||
sessions: .init()
|
||||
).routes)
|
||||
|
||||
try await Application(router: router).test(.router, body)
|
||||
} catch {
|
||||
defer {
|
||||
try? await fluent.shutdown()
|
||||
|
||||
throw error
|
||||
}
|
||||
|
||||
try await fluent.shutdown()
|
||||
await PrepareDB()(for: fluent)
|
||||
|
||||
try await fluent.migrate()
|
||||
|
||||
let router = Router(context: WebsiteRequestContext.self)
|
||||
|
||||
router.addRoutes(PasskeyController<WebsiteRequestContext>(
|
||||
origin: "http://localhost:8080",
|
||||
accounts: .init(fluent: fluent),
|
||||
sessions: .init()
|
||||
).routes)
|
||||
|
||||
try await Application(router: router).test(.router, body)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user