@@ -198,6 +198,51 @@ test.cb(
198
198
}
199
199
) ;
200
200
201
+ test . cb (
202
+ 'Route handler > returns isBase64Encoded on the response object when true in response data' ,
203
+ ( t ) => {
204
+ t . plan ( 3 ) ;
205
+ const lambdaCallback = ( err , response ) => {
206
+ t . is ( typeof response , 'object' ) ;
207
+ t . deepEqual ( response . body , '{}' ) ;
208
+ t . true ( response . isBase64Encoded ) ;
209
+ t . end ( ) ;
210
+ } ;
211
+
212
+ const alprParams = Object . assign ( { } , data ) ;
213
+ alprParams . callback = lambdaCallback ;
214
+
215
+ const alprLocal = new Alpr ( alprParams ) ;
216
+ alprLocal . route ( {
217
+ method : data . event . httpMethod ,
218
+ path : data . event . resource ,
219
+ handler : ( requestData , response ) => response ( { body : { } , isBase64Encoded : true } ) ,
220
+ } ) ;
221
+ }
222
+ ) ;
223
+
224
+ test . cb (
225
+ 'Route handler > returns response object without isBase64Encoded when undefined in response data' ,
226
+ ( t ) => {
227
+ t . plan ( 2 ) ;
228
+ const lambdaCallback = ( err , response ) => {
229
+ t . is ( typeof response , 'object' ) ;
230
+ t . not ( response . isBase64Encoded , true ) ;
231
+ t . end ( ) ;
232
+ } ;
233
+
234
+ const alprParams = Object . assign ( { } , data ) ;
235
+ alprParams . callback = lambdaCallback ;
236
+
237
+ const alprLocal = new Alpr ( alprParams ) ;
238
+ alprLocal . route ( {
239
+ method : data . event . httpMethod ,
240
+ path : data . event . resource ,
241
+ handler : ( requestData , response ) => response ( ) ,
242
+ } ) ;
243
+ }
244
+ ) ;
245
+
201
246
test ( 'String Matching > will return false when no params are provided' , ( t ) => {
202
247
// Just for default params
203
248
t . is ( Alpr . inArrayOrIsString ( ) , false ) ;
0 commit comments