serverless/tests/integration/Serverless.js
Philipp Muens aafc2fefd6 Rename and refactor existing plugins
Rename the existing plugins to match the new naming convention.
Fix bugs / refactor code / enhance test coverage alongside.
2016-05-25 07:12:15 +02:00

34 lines
923 B
JavaScript

'use strict';
/**
* Test: Serverless Integration
*/
const expect = require('chai').expect;
const exec = require('child_process').exec;
const path = require('path');
const TestsPlugin = require('../../lib/plugins/tests/tests');
describe('Serverless integration tests', () => {
it('should successfully run the "serverless test integration" command', (done) => {
const testsPlugin = new TestsPlugin();
const execute = (command, callback) => {
exec(command, (error, stdout, stderr) => {
if (stderr) {
throw new Error(stderr);
}
callback(stdout);
});
};
execute(`${path.join
(process.env.PWD, 'bin', 'serverless')} test integration --serverless-integration-test`,
(consoleOutput) => {
const commands = JSON.parse(consoleOutput);
expect(commands).to.deep.equal(testsPlugin.commands);
done();
});
});
});