hummingbird-project / hummingbird-lambda

Hummingbird running inside an AWS Lambda
Apache License 2.0
24 stars 3 forks source link

Lambda XCTest #25

Closed adam-fowler closed 6 months ago

adam-fowler commented 7 months ago

Test framework for HummingbirdLambda

try await HelloLambda.test { client in
   try await client.execute(uri: "/hello", method: .get) { response in
        XCTAssertEqual(response.body, "Hello")
        XCTAssertEqual(response.statusCode, .ok)
        XCTAssertEqual(response.headers?["Content-Type"], "text/plain; charset=utf-8")
    }
}

Test framework creates APIGateway event by constructing JSON of event. The response it returns is the Output type for the lambda.

Two tests are failing just now because multi value queries and headers aren't working in APIGatewayV2.