mirror of
https://github.com/serverless/serverless.git
synced 2025-12-08 19:46:03 +00:00
46 lines
1.1 KiB
JavaScript
46 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
/**
|
|
* Test: Tests Plugin
|
|
*/
|
|
|
|
const expect = require('chai').expect;
|
|
const Tests = require('../tests');
|
|
const TestsPlugin = require('../tests');
|
|
const exec = require('child_process').exec;
|
|
const path = require('path');
|
|
|
|
describe('Tests', () => {
|
|
let tests;
|
|
|
|
beforeEach(() => {
|
|
tests = new Tests();
|
|
});
|
|
|
|
describe('#constructor()', () => {
|
|
it('should have commands', () => expect(tests.commands).to.be.not.empty);
|
|
|
|
it('should have hooks', () => expect(tests.hooks).to.be.not.empty);
|
|
});
|
|
|
|
describe('#logItselfOnTerminal()', (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`,
|
|
(consoleOutput) => {
|
|
const commands = JSON.parse(consoleOutput);
|
|
expect(commands).to.deep.equal(testsPlugin.commands);
|
|
done();
|
|
});
|
|
});
|
|
});
|