Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lambda XCTest #25

Merged
merged 5 commits into from Mar 8, 2024
Merged

Lambda XCTest #25

merged 5 commits into from Mar 8, 2024

Conversation

adam-fowler
Copy link
Member

@adam-fowler adam-fowler commented Mar 4, 2024

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.

@adam-fowler adam-fowler requested a review from Joannis March 4, 2024 09:28
@adam-fowler adam-fowler linked an issue Mar 6, 2024 that may be closed by this pull request
@adam-fowler adam-fowler merged commit badc54e into 2.x.x Mar 8, 2024
2 of 3 checks passed
@adam-fowler adam-fowler deleted the 2.x.x-xctest branch March 8, 2024 08:29
adam-fowler added a commit that referenced this pull request Mar 12, 2024
* Start HummingbirdLambdaXCT

* Add APIGatewayV2 event init

* Tests now use HummingbirdLambdaXCT

* Comments/cleanup

* XCT -> Testing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2.x.x - Add test framework
2 participants