Skip to content

Commit

Permalink
test: add more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Malindu Warapitiya committed Mar 15, 2017
1 parent 88c4892 commit 1e5f77d
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions test/install_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,62 @@ describe('gulp-yarn', () => {
stream.end();
});

it('should run `yarn --version` with args property', done => {
const file = fixture('package.json');

const stream = yarn({
args: [
'--version'
]
});

stream.on('error', err => {
should.exist(err);
done(err);
});

stream.on('data', () => {
});

stream.on('end', () => {
commandRunner.run.called.should.equal(1);
commandRunner.run.commands[0].cmd.should.equal('yarn');
commandRunner.run.commands[0].args.should.eql(['--version']);
done();
});

stream.write(file);

stream.end();
});

it('should not run with invalid `package.json`', done => {
const file = fixture('package123.json');

const stream = yarn({
args: [
'--version'
]
});

stream.on('error', err => {
should.exist(err);
done(err);
});

stream.on('data', () => {
});

stream.on('end', () => {
commandRunner.run.called.should.equal(0);
done();
});

stream.write(file);

stream.end();
});

it('should run commandRunner', done => {
const commands = {
cmd: 'yarn',
Expand Down

0 comments on commit 1e5f77d

Please sign in to comment.