mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-01-25 21:36:18 +00:00
32 lines
692 B
JavaScript
32 lines
692 B
JavaScript
|
'use strict';
|
||
|
|
||
|
var expect = require('expect.js'),
|
||
|
ShellCommand = require('../../lib/command/shell').Command;
|
||
|
|
||
|
describe('Shell command', function() {
|
||
|
|
||
|
var shellCommand;
|
||
|
it('Should be created without errors', function() {
|
||
|
shellCommand = new ShellCommand({
|
||
|
isEmit: true
|
||
|
});
|
||
|
});
|
||
|
|
||
|
it('Default shell should be sh', function() {
|
||
|
expect(shellCommand.shell).equal('/bin/sh');
|
||
|
});
|
||
|
|
||
|
it('echo "Hello world" should be done', function(done) {
|
||
|
var stdout = '';
|
||
|
shellCommand.on('stdout', function(data) {
|
||
|
stdout += data;
|
||
|
});
|
||
|
shellCommand.run({cmd: 'echo "Hello world"'}, function(err) {
|
||
|
expect(err).not.ok();
|
||
|
expect(stdout).equal('Hello world\n');
|
||
|
done();
|
||
|
});
|
||
|
});
|
||
|
|
||
|
});
|