@@ -180,5 +180,53 @@ describe('S3 handler tests', () => {
180
180
assert ( result . body . includes ( "bucket not present" ) ) ;
181
181
} ) ;
182
182
} ) ;
183
+ it ( 'should fail to process a directory' , async ( ) => {
184
+
185
+ nock ( 'https://api-us1.scanii.com' )
186
+ . post ( '/v2.2/files/fetch' )
187
+ . reply ( 202 , Buffer . from ( "{\"id\":\"12356789\"}" ) , { "Location" : "https://api-us1.scanii.com/v2.2/files/1234" } ) ;
188
+
189
+ await handler ( {
190
+ "Records" : [
191
+ {
192
+ "eventVersion" : "2.0" ,
193
+ "eventSource" : "aws:s3" ,
194
+ "awsRegion" : "us-west-2" ,
195
+ "eventTime" : "2015-10-01T23:28:54.280Z" ,
196
+ "eventName" : "ObjectCreated:Put" ,
197
+ "userIdentity" : {
198
+ "principalId" : "AWS:principal"
199
+ } ,
200
+ "requestParameters" : {
201
+ "sourceIPAddress" : "98.167.155.191"
202
+ } ,
203
+ "responseElements" : {
204
+ "x-amz-request-id" : "EEC943B096DE3DF9" ,
205
+ "x-amz-id-2" : "W/myEjyXFBsOA6N0byxW0tOxMA4m1fmv9KAVcovvG0nD9W1s5aX5+Wx61tlCop8LbZAw1Nz0mnc="
206
+ } ,
207
+ "s3" : {
208
+ "s3SchemaVersion" : "1.0" ,
209
+ "configurationId" : "948c2c1a-a028-4564-93fc-76cea7622633" ,
210
+ "bucket" : {
211
+ "name" : "scanii-mu" ,
212
+ "ownerIdentity" : {
213
+ "principalId" : "principal"
214
+ } ,
215
+ "arn" : "arn:aws:s3:::scanii-mu"
216
+ } ,
217
+ "object" : {
218
+ "size" : 519 ,
219
+ "eTag" : "aa1e5c8a6a07217c25f55aa8e96ea37a" ,
220
+ "key" : "Screen+Shot+2016-01-19+at+7.24.37+PM.png" ,
221
+ "sequencer" : "00560DC1B62F962FCD"
222
+ }
223
+ }
224
+ }
225
+ ]
226
+ } , { } , ( error , result ) => {
227
+ assert ( error === null , "there should be no errors" ) ;
228
+ assert ( result . body . includes ( "cannot process directory" ) ) ;
229
+ } ) ;
230
+ } ) ;
183
231
} ) ;
184
232
0 commit comments