Initial Commit

This commit is contained in:
Christian Risi
2024-12-08 20:38:43 +00:00
parent c2539d2250
commit c863c66236
9 changed files with 335 additions and 287 deletions

View File

@@ -1,29 +1,29 @@
@testable import App
import XCTVapor
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.test(.GET, "hello", afterResponse: { res async in
#expect(res.status == .ok)
#expect(res.body.string == "Hello, world!")
})
}
}
}
@testable import App
import XCTVapor
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.test(.GET, "hello", afterResponse: { res async in
#expect(res.status == .ok)
#expect(res.body.string == "Hello, world!")
})
}
}
}