diff --git a/src/test/shell-test.js b/src/test/shell-test.js index 5b0cb87be..4f445f1e7 100644 --- a/src/test/shell-test.js +++ b/src/test/shell-test.js @@ -4,8 +4,9 @@ 'use strict'; -var expect = require('expect.js'), +const expect = require('expect.js'), path = require('path'), + safe = require('safetydance'), shell = require('../shell.js'); describe('shell', function () { @@ -46,13 +47,21 @@ describe('shell', function () { }); }); + it('can run valid program (promises)', async function () { + let RELOAD_NGINX_CMD = path.join(__dirname, '../src/scripts/restartservice.sh'); + await safe(shell.promises.sudo('test', [ RELOAD_NGINX_CMD, 'nginx' ], {})); + }); + it('execSync a valid shell program', function (done) { shell.exec('test', 'ls -l | wc -c', function (error) { - console.log(error); done(error); }); }); + it('execSync a valid shell program (promises)', async function () { + await shell.promises.exec('test', 'ls -l | wc -c'); + }); + it('execSync throws for invalid program', function (done) { shell.exec('test', 'cannotexist', function (error) { expect(error).to.be.ok();