35 lines
720 B
Swift
35 lines
720 B
Swift
import Configuration
|
|||
|
|
import Hummingbird
|
||
|
|
import HummingbirdTesting
|
||
|
|
import Logging
|
||
|
|
import Testing
|
||
|
|
|
||
|
|
@testable import Website
|
||
|
|
|
||
|
|
private let reader = ConfigReader(providers: [
|
||
|
|
InMemoryProvider(values: [
|
||
|
|
"http.host": "127.0.0.1",
|
||
|
|
"http.port": "0",
|
||
|
|
"log.level": "trace",
|
||
|
|
])
|
||
|
|
])
|
||
|
|
|
||
|
|
@Suite
|
||
|
|
struct AppTests {
|
||
|
|
@Test
|
||
|
|
func hello() async throws {
|
||
|
|
let app = try await application(
|
||
|
|
reader: reader
|
||
|
|
)
|
||
|
|
|
||
|
|
try await app.test(.router) { client in
|
||
|
|
try await client.execute(
|
||
|
|
uri: "/",
|
||
|
|
method: .get
|
||
|
|
) { response in
|
||
|
|
#expect(response.body == ByteBuffer(string: "Hello!"))
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|