1
0
mirror of https://github.com/thangisme/notes.git synced 2024-11-12 20:16:02 -05:00
notes/node_modules/write-file-stdout/test/index.js

23 lines
551 B
JavaScript
Raw Normal View History

2017-03-09 13:16:08 -05:00
var assert = require('assert');
var fs = require('fs');
var write = require('..');
describe('write-file-stdout', function () {
afterEach(function () {
if (fs.existsSync('fixture.txt')) fs.unlinkSync('fixture.txt');
});
it('should write to a file', function () {
write('fixture.txt', 'test');
assert.equal('test', fs.readFileSync('fixture.txt'));
});
it('should write to stdout', function (done) {
process.stdout.write = function (data) {
assert.equal('test', data);
done();
};
write('test');
});
});