Skip to content

Commit

Permalink
[enb#425] update test techs/write-file - check exists file or not exi…
Browse files Browse the repository at this point in the history
…sts of created with 'write-file'
  • Loading branch information
pavelpower committed Jan 19, 2016
1 parent 7505f6d commit 8174354
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions test/techs/write-file.test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
var mockFS = require('mock-fs'),
MockNode = require('mock-enb/lib/mock-node'),
FileProviderTech = require('../../techs/write-file');
WriteFileTech = require('../../techs/write-file');

describe('techs/write-file', function () {
var bundle,
resolveSpy,
rejectSpy;

beforeEach(function () {
mockFS({
'bundles': mockFS.directory({
mode: 0755
})
});

bundle = new MockNode('bundle');
resolveSpy = sinon.spy(bundle, 'resolveTarget');
rejectSpy = sinon.spy(bundle, 'rejectTarget');
Expand All @@ -18,7 +24,14 @@ describe('techs/write-file', function () {
});

it('should write target file to file system', function () {

return bundle.runTech(WriteFileTech, {
target: '?.txt',
content: 'I\'m here'
})
.should.be.fulfilled
.then(function () {
mockFS.statSync('bundles/bunlde/bundle.txt').isFile().should.be.ok;
resolveSpy.should.calledWith('bundle.txt');
});
});

});

0 comments on commit 8174354

Please sign in to comment.