@@ -12,9 +12,7 @@ describe("LambdaUtils", () => {
12
12
13
13
test ( "wrapApiHandler apiSuccess" , ( endTest ) => {
14
14
// GIVEN
15
- const expectResult = { hello : 'world' } ;
16
-
17
- const handler = LambdaUtils . wrapApiHandler ( async ( event : APIGatewayEvent ) : Promise < APIGatewayProxyResult > => {
15
+ const handler = LambdaUtils . wrapApiHandler ( async ( event : LambdaUtils . APIGatewayProxyEvent ) : Promise < APIGatewayProxyResult > => {
18
16
// Echo the event back
19
17
return LambdaUtils . apiSuccess ( event ) ;
20
18
} ) ;
@@ -52,10 +50,10 @@ describe("LambdaUtils", () => {
52
50
expect ( resultEvent . body ) . toEqual ( body ) ;
53
51
54
52
// Headers are normalized in request event
55
- expect ( resultEvent . headers [ 'content-length ' ] ) . toBeUndefined ( ) ;
56
- expect ( resultEvent . headers [ 'Content-Length ' ] ) . toEqual ( '0' ) ;
53
+ expect ( resultEvent . headers [ 'Content-Length ' ] ) . toBeUndefined ( ) ;
54
+ expect ( resultEvent . headers [ 'content-length ' ] ) . toEqual ( '0' ) ;
57
55
expect ( resultEvent . headers [ "CONTENT-TYPE" ] ) . toBeUndefined ( ) ;
58
- expect ( resultEvent . headers [ 'Content-Type ' ] ) . toEqual ( "application/json" ) ;
56
+ expect ( resultEvent . headers [ 'content-type ' ] ) . toEqual ( "application/json" ) ;
59
57
60
58
// pathParameters and queryStringParameters are expanded to empty objects
61
59
expect ( resultEvent . pathParameters ) . toEqual ( { } ) ;
@@ -67,9 +65,7 @@ describe("LambdaUtils", () => {
67
65
68
66
test ( "wrapApiHandler promise object success" , ( endTest ) => {
69
67
// GIVEN
70
- const expectResult = { hello : 'world' } ;
71
-
72
- const handler = LambdaUtils . wrapApiHandler ( async ( event : APIGatewayEvent ) : Promise < any > => {
68
+ const handler = LambdaUtils . wrapApiHandler ( async ( ) : Promise < any > => {
73
69
return { message : 'Hello' } ;
74
70
} ) ;
75
71
@@ -103,9 +99,7 @@ describe("LambdaUtils", () => {
103
99
104
100
test ( "wrapApiHandler promise empty success" , ( endTest ) => {
105
101
// GIVEN
106
- const expectResult = { hello : 'world' } ;
107
-
108
- const handler = LambdaUtils . wrapApiHandler ( async ( event : APIGatewayEvent ) : Promise < any > => {
102
+ const handler = LambdaUtils . wrapApiHandler ( async ( ) : Promise < any > => {
109
103
return ;
110
104
} ) ;
111
105
@@ -139,7 +133,7 @@ describe("LambdaUtils", () => {
139
133
140
134
test ( "wrapApiHandler throw Error" , ( endTest ) => {
141
135
// GIVEN
142
- const handler = LambdaUtils . wrapApiHandler ( async ( event : APIGatewayEvent ) : Promise < APIGatewayProxyResult > => {
136
+ const handler = LambdaUtils . wrapApiHandler ( async ( ) : Promise < APIGatewayProxyResult > => {
143
137
throw new Error ( "oops" ) ;
144
138
} ) ;
145
139
@@ -157,7 +151,7 @@ describe("LambdaUtils", () => {
157
151
158
152
test ( "wrapApiHandler throw http-error" , ( endTest ) => {
159
153
// GIVEN
160
- const handler = LambdaUtils . wrapApiHandler ( async ( event : APIGatewayEvent ) : Promise < APIGatewayProxyResult > => {
154
+ const handler = LambdaUtils . wrapApiHandler ( async ( ) : Promise < APIGatewayProxyResult > => {
161
155
throw new createError . NotFound ( ) ;
162
156
} ) ;
163
157
0 commit comments