나는 aws lambda를 조사 해왔다. api gateway 요청에 대한 응답을 테스트하는 사람들은 어떻게 반응합니까? 자바에서는 람다가 약간 있습니다.aws lambda js 단위 테스트
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());
}
저는 위의 내용을 복제하기 위해 Jest와 ES6에서 정말 간단하게하고 싶습니다. 유사한 이벤트 객체를 사용할 수 있습니까? 농담으로 그들을 어떻게 묶을 수 있습니까?