11const handler = require ( '../lib/index.js' ) . handler ;
22const generateSignature = require ( '../lib/index.js' ) . generateSignature ;
33const assert = require ( 'assert' ) ;
4- const context = require ( 'aws-lambda-mock-context' ) ;
54const it = require ( "mocha/lib/mocha.js" ) . it ;
65const describe = require ( "mocha/lib/mocha.js" ) . describe ;
76const AWS = require ( 'aws-sdk' ) ;
@@ -69,7 +68,7 @@ describe('Lifecycle tests', () => {
6968 }
7069 }
7170 ]
72- } , context ( ) , ( error , result ) => {
71+ } , { } , ( error , result ) => {
7372 "use strict" ;
7473 assert ( error === null , "there should be no errors" ) ;
7574 assert ( result === "12356789" , "should return the file id" ) ;
@@ -120,7 +119,7 @@ describe('Lifecycle tests', () => {
120119 }
121120 }
122121 ]
123- } , context ( ) , ( error ) => {
122+ } , { } , ( error ) => {
124123 "use strict" ;
125124 assert ( error !== null , "it should throw an error" ) ;
126125 assert ( error . message . includes ( "key not present" ) ) ;
@@ -171,7 +170,7 @@ describe('Lifecycle tests', () => {
171170 }
172171 }
173172 ]
174- } , context ( ) , ( error ) => {
173+ } , { } , ( error ) => {
175174 "use strict" ;
176175 assert ( error !== null , "it should throw an error" ) ;
177176 assert ( error . message . includes ( "bucket not present" ) ) ;
@@ -192,7 +191,7 @@ describe('Lifecycle tests', () => {
192191 "bucket" : "test-bucket" ,
193192 "key" : "test-key"
194193 }
195- } , context ( ) , ( error , result ) => {
194+ } , { } , ( error , result ) => {
196195 "use strict" ;
197196 assert ( error === null , "there should be no errors" ) ;
198197 assert ( result . statusCode === 200 ) ;
@@ -202,7 +201,7 @@ describe('Lifecycle tests', () => {
202201
203202 it ( 'should handle a bogus callback' , done => {
204203 handler ( { "hello" : "world" } ,
205- context ( ) , ( error ) => {
204+ { } , ( error ) => {
206205 "use strict" ;
207206 assert ( error !== null , "it should throw an error" ) ;
208207 assert ( error . message . includes ( "no id provided" ) ) ;
@@ -222,7 +221,7 @@ describe('Lifecycle tests', () => {
222221 "signature" : generateSignature ( "test-bucket" , "test-key" ) ,
223222 }
224223 } ,
225- context ( ) , ( error ) => {
224+ { } , ( error ) => {
226225 "use strict" ;
227226 assert ( error !== null , "it should throw an error" ) ;
228227 assert ( error . message . includes ( "no bucket supplied in metadata" ) ) ;
@@ -244,7 +243,7 @@ describe('Lifecycle tests', () => {
244243 "bucket" : "test-bucket" ,
245244 "key" : "test-key"
246245 }
247- } , context ( ) , ( error , result ) => {
246+ } , { } , ( error , result ) => {
248247 "use strict" ;
249248 assert ( error === null , "there should be no errors" ) ;
250249 assert ( result . statusCode === 200 ) ;
@@ -265,7 +264,7 @@ describe('Lifecycle tests', () => {
265264 "bucket" : "test-bucket" ,
266265 "key" : "test-key"
267266 }
268- } , context ( ) , ( error , result ) => {
267+ } , { } , ( error , result ) => {
269268 "use strict" ;
270269 assert ( error !== null , "it should throw an error" ) ;
271270 assert ( result === undefined ) ;
@@ -321,7 +320,7 @@ describe('Lifecycle tests', () => {
321320 "apiId" : "hfxx5vbk0b"
322321 } ,
323322 "body" : "{\n \"id\" : \"a62a6f0ba82f6ac11e95d09b8bdf965c\",\n \"checksum\" : \"4b7fbc3b0ae13fc444f4b4984d643f1f403228a2\",\n \"content_length\" : 41387,\n \"findings\" : [ ],\n \"creation_date\" : \"2016-10-15T00:15:35.264Z\",\n \"content_type\" : \"application/octet-stream\",\n \"metadata\" : {\n \"signature\" : \"" + generateSignature ( "test-bucket" , "test-key" ) + "\",\n \"bucket\" : \"test-bucket\",\n \"key\" : \"test-key\"\n }\n}"
324- } , context ( ) , ( error , result ) => {
323+ } , { } , ( error , result ) => {
325324 "use strict" ;
326325 assert ( error === null , "there should be no errors" ) ;
327326 assert ( result . statusCode === 200 ) ;
@@ -376,7 +375,7 @@ describe('Lifecycle tests', () => {
376375 "apiId" : "hfxx5vbk0b"
377376 } ,
378377 "body" : "{\n \"id\" : \"a62a6f0ba82f6ac11e95d09b8bdf965c\",\n \"checksum\" : \"4b7fbc3b0ae13fc444f4b4984d643f1f403228a2\",\n \"content_length\" : 41387,\n \"findings\" : [ \"content.malware\" ],\n \"creation_date\" : \"2016-10-15T00:15:35.264Z\",\n \"content_type\" : \"application/octet-stream\",\n \"metadata\" : {\n \"signature\" : \"" + generateSignature ( "test-bucket" , "test-key" ) + "\",\n \"bucket\" : \"test-bucket\",\n \"key\" : \"test-key\"\n }\n}"
379- } , context ( ) , ( error , result ) => {
378+ } , { } , ( error , result ) => {
380379 "use strict" ;
381380 assert ( error === null , "there should be no errors" ) ;
382381 assert ( result . statusCode === 200 ) ;
0 commit comments