Skip to content

Commit 8cf1697

Browse files
authored
Removed awsk-lambda-mock-context (#13)
1 parent 3729b47 commit 8cf1697

File tree

4 files changed

+13
-45
lines changed

4 files changed

+13
-45
lines changed

package-lock.json

Lines changed: 1 addition & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "scanii-lambda",
3-
"version": "0.5.1",
3+
"version": "0.5.2",
44
"description": "",
55
"main": "index.js",
66
"scripts": {
@@ -12,7 +12,6 @@
1212
"aws-sdk": "^2.6.3"
1313
},
1414
"devDependencies": {
15-
"aws-lambda-mock-context": "^3.0.0",
1615
"mocha": "^2.5.3",
1716
"nock": "^9.2.5"
1817
}

tests/lifecycle.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const handler = require('../lib/index.js').handler;
22
const generateSignature = require('../lib/index.js').generateSignature;
33
const assert = require('assert');
4-
const context = require('aws-lambda-mock-context');
54
const it = require("mocha/lib/mocha.js").it;
65
const describe = require("mocha/lib/mocha.js").describe;
76
const 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);

tests/sns.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const handler = require('../lib/index.js').handler;
22
const generateSignature = require('../lib/index.js').generateSignature;
33
const assert = require('assert');
4-
const context = require('aws-lambda-mock-context');
54
const it = require("mocha/lib/mocha.js").it;
65
const describe = require("mocha/lib/mocha.js").describe;
76
const AWS = require('aws-sdk');
@@ -84,7 +83,7 @@ describe('SNS tests', () => {
8483
"apiId": "hfxx5vbk0b"
8584
},
8685
"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}"
87-
}, context(), (error, result) => {
86+
}, {}, (error, result) => {
8887
"use strict";
8988
assert(error === null, "there should be no errors");
9089
assert(result.statusCode === 200);

0 commit comments

Comments
 (0)