11const test = require ( 'ava' )
22
3- const { builderFunction } = require ( '../src/lib/builder_functions ' )
3+ const { builder } = require ( '../src/lib/builder ' )
44
55const { invokeLambda } = require ( './helpers/main' )
66
@@ -20,7 +20,7 @@ test('Injects the metadata object into an asynchronous handler', async (t) => {
2020
2121 return originalResponse
2222 }
23- const response = await invokeLambda ( builderFunction ( myHandler ) )
23+ const response = await invokeLambda ( builder ( myHandler ) )
2424
2525 t . deepEqual ( response , { ...originalResponse , ...METADATA_OBJECT } )
2626} )
@@ -33,7 +33,7 @@ test('Injects the metadata object into a synchronous handler', async (t) => {
3333 const myHandler = ( event , context , callback ) => {
3434 callback ( null , originalResponse )
3535 }
36- const response = await invokeLambda ( builderFunction ( myHandler ) )
36+ const response = await invokeLambda ( builder ( myHandler ) )
3737
3838 t . deepEqual ( response , { ...originalResponse , ...METADATA_OBJECT } )
3939} )
@@ -52,7 +52,7 @@ test('Does not inject the metadata object for non-200 responses', async (t) => {
5252
5353 return originalResponse
5454 }
55- const response = await invokeLambda ( builderFunction ( myHandler ) )
55+ const response = await invokeLambda ( builder ( myHandler ) )
5656
5757 t . deepEqual ( response , originalResponse )
5858} )
@@ -71,7 +71,7 @@ test('Returns a 405 error for requests using the POST method', async (t) => {
7171
7272 return originalResponse
7373 }
74- const response = await invokeLambda ( builderFunction ( myHandler ) , { method : 'POST' } )
74+ const response = await invokeLambda ( builder ( myHandler ) , { method : 'POST' } )
7575
7676 t . deepEqual ( response , { body : 'Method Not Allowed' , statusCode : 405 } )
7777} )
@@ -90,7 +90,7 @@ test('Returns a 405 error for requests using the PUT method', async (t) => {
9090
9191 return originalResponse
9292 }
93- const response = await invokeLambda ( builderFunction ( myHandler ) , { method : 'PUT' } )
93+ const response = await invokeLambda ( builder ( myHandler ) , { method : 'PUT' } )
9494
9595 t . deepEqual ( response , { body : 'Method Not Allowed' , statusCode : 405 } )
9696} )
@@ -109,7 +109,7 @@ test('Returns a 405 error for requests using the DELETE method', async (t) => {
109109
110110 return originalResponse
111111 }
112- const response = await invokeLambda ( builderFunction ( myHandler ) , { method : 'DELETE' } )
112+ const response = await invokeLambda ( builder ( myHandler ) , { method : 'DELETE' } )
113113
114114 t . deepEqual ( response , { body : 'Method Not Allowed' , statusCode : 405 } )
115115} )
@@ -128,7 +128,7 @@ test('Returns a 405 error for requests using the PATCH method', async (t) => {
128128
129129 return originalResponse
130130 }
131- const response = await invokeLambda ( builderFunction ( myHandler ) , { method : 'PATCH' } )
131+ const response = await invokeLambda ( builder ( myHandler ) , { method : 'PATCH' } )
132132
133133 t . deepEqual ( response , { body : 'Method Not Allowed' , statusCode : 405 } )
134134} )
@@ -148,7 +148,7 @@ test('Preserves errors thrown inside the wrapped handler', async (t) => {
148148 throw error
149149 }
150150
151- await t . throwsAsync ( invokeLambda ( builderFunction ( myHandler ) ) , { is : error } )
151+ await t . throwsAsync ( invokeLambda ( builder ( myHandler ) ) , { is : error } )
152152} )
153153
154154test ( 'Does not pass query parameters to the wrapped handler' , async ( t ) => {
@@ -165,7 +165,7 @@ test('Does not pass query parameters to the wrapped handler', async (t) => {
165165 }
166166 const multiValueQueryStringParameters = { foo : [ 'bar' ] , bar : [ 'baz' ] }
167167 const queryStringParameters = { foo : 'bar' , bar : 'baz' }
168- const response = await invokeLambda ( builderFunction ( myHandler ) , {
168+ const response = await invokeLambda ( builder ( myHandler ) , {
169169 multiValueQueryStringParameters,
170170 queryStringParameters,
171171 } )
0 commit comments