Skip to content

Commit

Permalink
Add test for spawn command
Browse files Browse the repository at this point in the history
  • Loading branch information
SBoudrias committed Feb 8, 2015
1 parent 1059528 commit c8495ad
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/spawn_command.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
'use strict';

var assert = require('assert');
var proxyquire = require('proxyquire');
var sinon = require('sinon');

describe('#spawnCommand()', function () {
beforeEach(function () {
this.crossSpawn = sinon.spy();
this.spawn = proxyquire('../lib/actions/spawn_command', {
'cross-spawn': this.crossSpawn
});
});

it('provide default options', function () {
this.spawn('foo');
sinon.assert.calledWith(this.crossSpawn, 'foo', undefined, { stdio: 'inherit' });
});

it('pass arguments', function () {
this.spawn('foo', 'bar');
sinon.assert.calledWith(this.crossSpawn, 'foo', 'bar', { stdio: 'inherit' });
});

it('pass options', function () {
this.spawn('foo', undefined, { foo: 1 });
sinon.assert.calledWith(this.crossSpawn, 'foo', undefined, { foo: 1, stdio: 'inherit' });
});

it('allow overriding default options', function () {
this.spawn('foo', undefined, { stdio: 'wut' });
sinon.assert.calledWith(this.crossSpawn, 'foo', undefined, { stdio: 'wut' });
});
});

0 comments on commit c8495ad

Please sign in to comment.