1
0
mirror of https://github.com/thangisme/notes.git synced 2024-11-09 17:07:21 -05:00
notes/node_modules/write-file-stdout/test/index.js
Patrick Marsceill b7b0d0d7bf
Initial commit
2017-03-09 13:16:08 -05:00

23 lines
551 B
JavaScript

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');
});
});