Initial Commit
This commit is contained in:
@@ -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!")
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user