feat: Begins adding html snapshot tests.

This commit is contained in:
2025-03-07 09:08:08 -05:00
parent b42b9cf03b
commit 35a54db9a3
30 changed files with 1011 additions and 66 deletions

View File

@@ -1,29 +1,29 @@
@testable import App
import VaporTesting
import Testing
@Suite("App Tests")
struct AppTests {
private func withApp(_ test: (Application) async throws -> ()) async throws {
let app = try await Application.make(.testing)
do {
try await configure(app)
try await test(app)
}
catch {
try await app.asyncShutdown()
throw error
}
try await app.asyncShutdown()
}
@Test("Test Hello World Route")
func helloWorld() async throws {
try await withApp { app in
try await app.testing().test(.GET, "hello", afterResponse: { res async in
#expect(res.status == .ok)
#expect(res.body.string == "Hello, world!")
})
}
}
}
// @testable import App
// import VaporTesting
// import Testing
//
// @Suite("App Tests")
// struct AppTests {
// private func withApp(_ test: (Application) async throws -> ()) async throws {
// let app = try await Application.make(.testing)
// do {
// try await configure(app)
// try await test(app)
// }
// catch {
// try await app.asyncShutdown()
// throw error
// }
// try await app.asyncShutdown()
// }
//
// @Test("Test Hello World Route")
// func helloWorld() async throws {
// try await withApp { app in
// try await app.testing().test(.GET, "hello", afterResponse: { res async in
// #expect(res.status == .ok)
// #expect(res.body.string == "Hello, world!")
// })
// }
// }
// }