I've been looking into aws lambda. How are people testing the harness for api gateway requests responses? In Java I have a lambda that's a bit like this.
import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent;
import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
...
@Test
void turnsBarToFooTest() {
TestContext ctx = new TestContext(); //implements com.amazonaws.services.lambda.runtime.Context
Fooer handler = new Fooer();
APIGatewayProxyRequestEvent request = new APIGatewayProxyRequestEvent();
Map<String, String> params = HashMap.of("thing_to_foo", "bar");
request.setPathParameters(params.toJavaMap());
APIGatewayProxyResponseEvent response = handler.handleRequest(request, ctx);
assertEquals(200, response.getStatusCode().intValue());
assertEquals("foo", response.getBody());
}
I'd love to do something really simple with Jest and ES6 to replicate the above. Are there similar known events objects to use? How can I wire them up with jest.