Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add _readArchive tests called in _archive #216

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions test/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,34 @@ describe('node-lambda', function () {
done();
});
});

describe('If value is set in `deployZipfile`, _readArchive is executed in _archive', function () {
it('`deployZipfile` is a invalid value. Process from creation of zip file', function (done) {
const _program = Object.assign({ deployZipfile: '/aaaa/bbbb' }, program);
this.timeout(30000); // give it time to zip
lambda._archive(_program, function (err, data) {
// same test as "installs and zips with an index.js file and node_modules/async"
var archive = new zip(data);
var contents = _.map(archive.files, function (f) {
return f.name.toString();
});
var result = _.includes(contents, 'index.js');
assert.equal(result, true);
result = _.includes(contents, 'node_modules/async/lib/async.js');
assert.equal(result, true);
done();
});
});

it('`deployZipfile` is a valid value._archive reads the contents of the zipfile', function (done) {
const _program = Object.assign({ deployZipfile: testZipFile }, program);
lambda._archive(_program, function (err, data) {
assert.isNull(err);
assert.deepEqual(data, bufferExpected);
done();
});
});
});
});

describe('environment variable injection at runtime', function () {
Expand Down