Skip to content

Commit

Permalink
[enb#425] change test for techs/write-file.js. Added checking of file…
Browse files Browse the repository at this point in the history
…'s content
  • Loading branch information
pavelpower committed Jan 30, 2016
1 parent 0674bef commit 30706b4
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions test/techs/write-file.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,15 @@ describe('techs/write-file', function () {
mockFS.restore();
});

it('should get error if param "content" in undefined', function () {
(function () {
bundle.runTech(WriteFileTech, {
target: '?.bemjson.js'
})
.should.be.rejectedWith('Error: Option "content" is required for technology "write-file".')
.then(function () {
rejectSpy.should.calledWith('bundle.bemjson.js');
});
}).should.throw('Option "content" is required for technology "write-file".');
});

it('should write target file to file system', function () {
return bundle.runTech(WriteFileTech, {
target: '?.txt',
content: 'I\'m here'
})
.should.be.fulfilled
.then(function () {
require('fs').statSync('bundle/bundle.txt').isFile().should.be.ok;

resolveSpy.should.calledWith('bundle.txt');
require('fs').readFileSync('bundle/bundle.txt').toString().to.deep.equal('I\'m here')
});
});
});

0 comments on commit 30706b4

Please sign in to comment.