@tsed/platform-serverless-testing
Version:
Module to test Serverless function with Ts.ED
31 lines (30 loc) • 812 B
JavaScript
export function createFakeEvent(event = {}) {
return {
body: "",
headers: {},
httpMethod: "",
isBase64Encoded: false,
multiValueHeaders: {},
multiValueQueryStringParameters: {},
path: event.path || "/",
pathParameters: {},
queryStringParameters: {},
resource: "",
stageVariables: {},
...event,
requestContext: {
...event?.requestContext,
accountId: "",
apiId: "",
protocol: "https",
httpMethod: "",
identity: {},
path: event.path || "/",
stage: "",
requestId: "requestId",
requestTimeEpoch: 0,
resourceId: 1,
resourcePath: event.path || "/"
}
};
}