Skip to content

Commit

Permalink
Unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Schmid committed Mar 8, 2018
1 parent 2dc4450 commit 3bf0a0c
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions lib/packagers/yarn.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,36 @@ describe('yarn', () => {
expect(yarnModule.mustCopyModules).to.be.false;
});

describe('getProdDependencies', () => {
it('should use yarn list', () => {
childProcessMock.exec.yields(null, '{}', '');
return expect(yarnModule.getProdDependencies('myPath', 1, 2000)).to.be.fulfilled
.then(result => {
expect(result).to.be.an('object');
expect(childProcessMock.exec).to.have.been.calledOnce;
expect(childProcessMock.exec).to.have.been.calledWithExactly(
'yarn list --depth=1 --json --production',
{
cwd: 'myPath',
encoding: 'utf8',
maxBuffer: 2000
},
sinon.match.any
);
return null;
});
});
});

describe('rebaseLockfile', () => {
it('should return the original lockfile', () => {
const testContent = 'eugfogfoigqwoeifgoqwhhacvaisvciuviwefvc';
const testContent2 = 'eugfogfoigqwoeifgoqwhhacvaisvciuviwefvc';
yarnModule.rebaseLockfile('.', testContent);
expect(testContent).to.equal(testContent2);
});
});

describe('install', () => {
it('should use yarn install', () => {
childProcessMock.exec.yields(null, 'installed successfully', '');
Expand Down

0 comments on commit 3bf0a0c

Please sign in to comment.